在将某个目录添加到git版本库、或提交某个git版本库的改动时,可能希望忽略掉一些文件或目录(如编译时生成的.o、.a文件等),可以修改.git/info/exclude文件来实现。
举例如下:
vi .git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
*.[oa] #忽略以.o或.a结尾的文件或目录
*.pyc
*.exe #忽略以.exe结尾的文件或目录
.* #忽略以.开头的文件或目录
*.rar
*.zip
*.gz
*.bz2
*.db
*.sqlite