切换分支时,不要删除文件 [英] Git not removing files when switching branch
问题描述
有时当使用Git(版本1.7.2.1)
切换分支时,它似乎并没有删除我创建的文件/目录,这些文件/目录是特定于我切换的分支的。
在运行 git status
或这些文件的任何日志条目时,它都没有将其列为未跟踪。
这只是偶尔发生,我不知道为什么或如何重置它,以便不属于当前分支的文件被删除。
如果我手动删除文件,它会再次同步(如在切换分支时删除/恢复)。
任何人都有这种感觉?
我也看到了。我通常只做一个 git reset --hard
,然后是 git clean -f -d
,它通常会执行诀窍。
当我的IDE锁定了我正在切换的分支中的某个文件时,似乎肯定发生了这种情况。
Sometimes when switching branches using Git (version 1.7.2.1)
it does not seem to remove the files/directories I created specific to the branch I switched away from.
Neither does it list it as untracked when running git status
or any log entries for those files.
This only happens occasionally and I'm not sure why or how to reset it so the files not belonging to the current branch gets deleted. If I delete the files manually, it gets in sync again (as in gets deleted/revived when switching branch).
Anyone experienced this?
I have seen this too. I usually just do a git reset --hard
followed by a git clean -f -d
and it usually does the trick.
It seems to definitely happen the most often when my IDE has a lock on one of the files in the branch i'm switching from.
这篇关于切换分支时,不要删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!