语法
指定过滤某个文件
a.txt指定过滤某种类型
*.zip *.rar过滤某个目录
dir/不过滤某个文件
!b.txt用法
先将.gitignore提交到远程仓库,然后删除掉远程仓库中包含过滤文件的缓冲,再次提交过滤的文件发现无法提交了
[lkc@lkcdeMacBook-Pro:] ~/Desktop/Code/gitSample $ git add .gitignore [lkc@lkcdeMacBook-Pro:] ~/Desktop/Code/gitSample $ git ci -m "ignore" [master acaf1c2] ignore 2 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 .idea/vcs.xml [lkc@lkcdeMacBook-Pro:] ~/Desktop/Code/gitSample $ git st On branch master nothing to commit, working tree clean [lkc@lkcdeMacBook-Pro:] ~/Desktop/Code/gitSample $ git add .idea/vcs.xml The following paths are ignored by one of your .gitignore files: .idea/vcs.xml Use -f if you really want to add them. [lkc@lkcdeMacBook-Pro:] ~/Desktop/Code/gitSample $