Search code examples
githubgitignore

Ignore all .cpp file in Flutter repository


Every time I create Flutter public repository, the languages ​​highlighted by github are c++ files and make the dart files contained in the repository blocked. Are there some c++ file that i can put in gitignore safely? Is it safe to ignore all .cpp or .cc file in my flutter repositories?

I have to write a lot of dart files to be highlighted and dominated on the languages ​​bar.


Solution

  • You can use a .gitattributes file to override the language(s) detected by GitHub

    # Do not detect
    *.cc -linguist-detectable
    *.cpp -linguist-detectable
    
    # Detect
    *.dart linguist-detectable
    

    That way, the language bar will list and reflect only dart source files.