以下未跟踪的工作树文件将被覆盖 [英] The following untracked working tree files would be overwritten by
问题描述
尝试将远程分支分支到我的工作场所之后,
after trying to branch a remote branch to my workplace,
我收到以下错误:
**$ git checkout -b canc_el --track origin/canc**
error: The following untracked working tree files would be overwritten by checkout:
src/iphone/FacebookSDK.framework/Headers
src/iphone/FacebookSDK.framework/Resources
src/iphone/FacebookSDK.framework/Versions/Current
src/iphone/Xcode/Crashlytics.framework/Headers
Please move or remove them before you can switch branches.
Aborting
这很奇怪.我尚未将其从跟踪中移除.
That's strange. I haven't removed them from tracking.
我希望它们被覆盖.我对他们一无所知.
I want them to be overriden. I know nothing much about them.
我该怎么办?
更新
我尝试删除并检出这些文件夹并收到此错误:
I have tried to remove and checkout these folders and got this error:
$ git rm src/iphone/FacebookSDK.framework/Headers
fatal: pathspec 'src/iphone/FacebookSDK.framework/Headers' did not match any files
$ git checkout src/iphone/FacebookSDK.framework/Headers
error: pathspec 'src/iphone/FacebookSDK.framework/Headers' did not match any file(s) known to git.
推荐答案
似乎这些文件未在您当前的分支中被跟踪,但是在origin/canc
上.
It seems those files aren't tracked in your current branch, but are on origin/canc
.
最简单的方法是先rm
个,然后再checkout
个.如果要更加谨慎,请add
和stash
它们,或以任何方式备份它们.
The simplest thing to do is just rm
them and then checkout
. If you want to be more cautious, add
and stash
them, or backup them in any way.
如果我错了,请纠正我. git status --short
应该将它们列出为未跟踪,或者git clean -ndX
应该将它们列出为被忽略,而git diff --name-status origin/canc HEAD
也应该列出它们.
Please correct me if I'm wrong. git status --short
should list them as untracked, or git clean -ndX
should list them as ignored, and git diff --name-status origin/canc HEAD
should list them too.
这篇关于以下未跟踪的工作树文件将被覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!