简体   繁体   中英

Removed files on branch preventing git checkout

In my project I've got 3 branches : - master - dev - sync

I've done a bunch of work in sync, and somewhere along the way got fed up of committing xcode project files that I changed my gitignore to exclude them, stopped them being tracked, and removed them. This is fine, but now I want to merge my changes on sync back into dev.

Every time I try and checkout dev in order to merge, I get the error :

error: The following untracked working tree files would be overwritten by checkout:
ManagePlaces/ManagePlaces.xcodeproj/project.xcworkspace/xcuserdata/Aidy.xcuserdatad/UserInterfaceState.xcuserstate
ManagePlaces/ManagePlaces.xcodeproj/project.xcworkspace/xcuserdata/Aidy.xcuserdatad/xcdebugger/Expressions.xcexplist
ManagePlaces/ManagePlaces.xcodeproj/xcuserdata/Aidy.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
ManagePlaces/ManagePlaces.xcodeproj/xcuserdata/Aidy.xcuserdatad/xcschemes/ManagePlaces.xcscheme
ManagePlaces/ManagePlaces.xcodeproj/xcuserdata/Aidy.xcuserdatad/xcschemes/xcschememanagement.plist

Please move or remove them before you can switch branches.

I understand why this is happening as the dev branch hasn't had these files removed and is still tracking them, but how can I get around this?

只需在您的结帐命令中添加--force即可。

I believe you can do this:

git checkout -- <file>

This should reset them to the last commit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM