git忽略已经被提交的文件
.gitignore 已经有了 由于每次本地运行项目,都会生成新的log文件,但是我并不想提交logs文件夹里面的内容,所以要在.gitignore写logs的规则。 我尝试过添加以下规则 logs/*.log logs/ /logs/ 正确的做法应该是: git rm --cached logs/xx.log .gitignore git commit -m "We really don't want Git to track this anymore!" 具体的原因如下: git update-index 所有的团队成员都必须对目标文件执行: git update-index --assume-unchanged <PATH> fetch git update-index --assume-unchanged <PATH> push update-index clone update-index 。 首先, git update-index Register file contents in the working tree to the index(把工作区下的文件内容注册到索引区) 这句话暗含的意思是: update-index --assume-unchanged When the "assume unchanged" bit is on, Git stops