bash$ cat .gitignore
*.bak
*~
*.o
*.qft_auto
CVS
每次當文件夾CVS下內容更改,git status總提示CVS下內容modified.
顯然這時.gitignore沒有生效。原因是我在.gitignore中加入CVS字段前,已將CVS下的文件add到Git中,
所以.gitignore對CVS失效。只有將Git cache中CVS相關項刪掉,.gitignore纔會生效。
我如下執行:
$ find . -iname "CVS" -type d -exec git rm -rf --cached {} \;
這樣,文件系統中CVS內容還在,但git的repository中CVS已刪。
$ git commit -as
以後CVS目錄下內容再變,Git已不再關注,.gitignore生效。