Force GitHub Linguist language detection

GitHub Linguist is reasonably accurate at automatically detecting the percentages of each code language in Git tracked code. However, as with any automatic coding language detection scheme, mis-detected languages occur. This seems to happen for our uses most often with Matlab code. Despite being in the top 10 STEM / data science languages, Matlab / GNU Octave *.m files can be detected as other languages such as Objective-C or Limbo.

Fix

Add to each Matlab repo’s .gitattributes file:

*.m linguist-language=Matlab

Verify

Simply git push your code and look at the GitHub repo language graph.

If you frequently need to auto-detect code and prefer Python, consider our Linguist Python wrapper of GitHub Linguist.