我已经学会了如何在git中排除整个目录 (添加一个行bin/到.gitignore )。 而且我已经学会了如何在“事实之后”忽略文件 (即在将它们添加到git之后):
git rm --cached <filename>如何在添加到Git仓库后忽略整个目录 (例如bin/ )?
我试过git rm --cached bin/但我收到的是错误:
致命:pathspec'bin /'不匹配任何文件
当我尝试(在根目录下,.git存在的地方) git rm --cached MyProj/bin/错误是不同的:
致命的:不递归地移除'MyProj / bin /'而不使用-r
这意味着什么,我现在需要提交和/或分支它?
I've learned how to exclude an entire directory in git (add a line bin/ to .gitignore). And I've learned how to ignore files "after the fact" (i.e. after they have been added to git):
git rm --cached <filename>How do I ignore an entire directory (e.g. bin/) after it has been added to a Git repo?
I tried git rm --cached bin/ but all I received was the error:
fatal: pathspec 'bin/' did not match any files
When I tried (at the root directory, where .git exists) git rm --cached MyProj/bin/ the error is different:
fatal: not removing 'MyProj/bin/' recursively without -r
What does this mean and will I need to commit and/or branch this now?
最满意答案
我能够使用git rm -r --cached bin/ (注意recursive -r )在repo的根目录下工作 - 您是在谈论如何找到 bin目录并解开它们?
排除反映之前,您必须commit 。
我刚刚看到你在Windows上。 这是在OSX的终端,只是一个头。
I was able to get this working with git rm -r --cached bin/ (note the recursive -r)in the root of the repo - are you talking about finding the bin directories and untracking them?
You will have to commit before the exclusion is reflected.
I just saw that you were on Windows. This was in Terminal on OSX, just a heads up.
更多推荐
发布评论