I am preparing Python script which will diff files from git commits log, and write difference into pretty printed html file.
I would like to color source code similarly to what is done on GitHub diff, and for that I would like to use pygments. There is only one problem, it will need information about language in which source code is written, thus I must fetch it somehow.
I was wondering if there is possibility to fetch it directly from local copy of repository (preferred) or GitHub itself. GitHub is using linguist so the work is already done why not use that? Moreover when we enter specific language link from below language bar information on GitHub UI interface you can clearly see all the files which were recognised as written in selected language.
I saw some information about .gitattributes file that you can set language for files in there, but I would need to set it manually, and after project update I would have to update that file with all added files.