我正在使用 Rubygems,它在 git 中缓存了很多文件。简单的解决方案就是运行git rm -rf . --cached
,但是当我运行它时,会出现以下消息:
fatal: pathspec '' did not match any files
即使我运行git rm -rf ./\* --cached
,它仍然返回:
fatal: pathspec '*' did not match any files
有什么解决办法吗?
The correct syntax would be:
git rm -r -f --cached -- .
(ie the path should be at the end)
But if git status
mentions that no files have been added, then nothing 'cached' would be there to be removed.
When
--cached
is given, the staged content has to match:
- either the tip of the branch
- or the file on disk,
allowing the file to be removed from just the index.