Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github misclassifies Matlab .m files as Objective-C files

I'm new to Git and I'm trying to push my local branch to the remote directory on Github. My project is on Matlab, so the files have .m extension. They naturally don't show any objective-c language pattern. I even checked in some .mat files. But they are misclassified as Objective-C files.

I would like to know:

  • After push, can we modify directly the language in Github? I'm sorry if it is very easy to find, but I really couldn't find that.

  • I find that other people's Matlab project could be correctly classified, with just .m extension. Some people also mentioned if you name your files with .matlab extension, it could be easily recognized as Matlab language, but it's not a clean solution. I would like to know, what are the criteria that files could be recognized as matlab with .m extension or just to increase the chance to be recognized as matlab language. I noted that some people just add matlab in their file name, but people who don't do that also succeeded.

I've sent an email to Github for help. They answered the first question: the answer is no.

GitHub determines the language based on the total size of the files that belong to each language. We use the Linguist library to analyze source code files: https://github.com/github/linguist

like image 586
wceo Avatar asked Nov 25 '12 21:11

wceo


1 Answers

It is now possible to use Linguist overrides to override the detection results from Linguist. In particular, you can use a .gitattributes file in your repository:

*.m linguist-language=Objective-C

Note: If you're checking locally, you'll need to commit the .gitattributes file before you see the effect.

like image 77
pchaigno Avatar answered Oct 25 '22 12:10

pchaigno