在设置commit
之前我错误地.gitignore
。
现在我正在清理我的存储库。
我用:
git update-index --assume-unchanged fileToBeUntracked
然后我从存储库中删除它们,我的意思是我想从索引中删除但保留文件:
git rm -r --cached fileToBeRemoved
问题是我有,让我们说.classpath
存在于多个文件夹中。我收到以下错误:
fatal: pathspec '.classpath' did not match any files
是否与grep
组合允许我从所有文件夹中删除所有.classpath
,因为我知道我使用了带有删除命令的选项-r
但它不起作用。
答案 0 :(得分:0)
您可以使用git-filter-branch在每次提交时运行命令:
git filter-branch --tree-filter 'find . -name .classpath -delete' HEAD
一般情况下,请查看git网站上的Rewriting History。