问题
after trying to branch a remote branch to my workplace,
I get the following error:
**$ 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.
What should I do?
Update
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.
回答1:
It seems those files aren't tracked in your current branch, but are on origin/canc.
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.
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.
来源:https://stackoverflow.com/questions/18212192/the-following-untracked-working-tree-files-would-be-overwritten-by