Git结帐文件删除混乱

时间:2012-10-08 10:12:45

标签: git git-checkout

所以我尝试改变分支,我得到:

error: The following untracked working tree files would be overwritten by checkout:
env/local/include
    # many more files
env/local/lib
Please move or remove them before you can switch branches.
Aborting

所以我按stackoverflow.com/ignoring-a-directory-from-a-git-repo-after-its-been-added

的建议尝试git rm -r --cached .

我得到了:

 fatal: pathspec 'env/' did not match any files

我尝试了其他各种途径。那里有文件吗?如果是这样,我怎么能让git忽略它们?

由于

1 个答案:

答案 0 :(得分:1)

git rm -r --cached .适用于已添加到索引中的文件 但是,如果您尚未添加env/,则可以考虑添加env/并将其存储(作为in this question)。

要注意的其他要素: