gitattributesgithub-linguist

How can I remove a file from linguist in github?


I have a golang project, but am using a bit of c++. I downloaded a header file dependency, nlohmann/json, and is 22875 lines long, so naturally my github languages is not showing the proper language (Go) and is instead showing c++. How can I remove the json.hpp from the github linguist? I know that the .gitattributes file exists and I can change the language of some files, but how can I remove a file entirely from the linguist?


Solution

  • You can't tell Linguist to skip a file entirely. But I don't think that's actually what you want, as you don't care if it remains highlighted, right? You can tell Linguist to ignore some files when computing language statistics. In your case, the best way to do that would be to declare these C++ files vendored, with e.g.:

    *.hpp linguist-vendored
    

    See Linguist's README for more information.