可以在工程目录下建一个名为 .gitignore 文本文件,将你要忽略的文件类型保存在该文件中。
下面是我C++项目的.gitignore文件内容
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# Dir
build-Release/
build-Debug/
#The user local envirment file
*.user