gitignore binary files that have no extension

前端 未结 18 1244
没有蜡笔的小新
没有蜡笔的小新 2020-11-28 02:14

How can binary files be ignored in git using the .gitignore file?

Example:

$ g++ hello.c -o hello

The

18条回答
  •  日久生厌
    2020-11-28 02:34

    Add something like

    *.o
    

    in the .gitignore file and place it at the root of your repo ( or you can place in any sub directory you want - it will apply from that level on ) and check it in.

    Edit:

    For binaries with no extension, you are better off placing them in bin/ or some other folder. Afterall there is no ignore based on content-type.

    You can try

    *
    !*.*
    

    but that is not foolproof.

提交回复
热议问题