gitignore binary files that have no extension

前端 未结 18 1199
没有蜡笔的小新
没有蜡笔的小新 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:27

    # Ignore all
    *
    
    # Unignore all with extensions
    !*.*
    
    # Unignore all dirs
    !*/
    
    ### Above combination will ignore all files without extension ###
    
    # Ignore files with extension `.class` & `.sm`
    *.class
    *.sm
    
    # Ignore `bin` dir
    bin/
    # or
    */bin/*
    
    # Unignore all `.jar` in `bin` dir
    !*/bin/*.jar
    
    # Ignore all `library.jar` in `bin` dir
    */bin/library.jar
    
    # Ignore a file with extension
    relative/path/to/dir/filename.extension
    
    # Ignore a file without extension
    relative/path/to/dir/anotherfile
    

提交回复
热议问题