Using Git with Xcode (4.3) is a real nightmare.
Here’s a scenario…
I want to add a new feature, so I create a new topic branch.
I add my new feature and I’m ready to commit, rebase and merge…
I commit my changes – fine.
I jump back to master to pull changes (in case someone else has updated the code).
Suddenly I get:
error: Your local changes to the following files would be overwritten by checkout:
myProject/project.xcworkspace/xcuserdata/Bodacious.xcuserdatad/UserInterfaceState.xcuserstate
huh? I just committed.
Xcode likes to change my project.xcworkspace files every other second which makes it almost impossible to make clean, atomic commits.
What’s more, if I do commit the changes in project.xcworkspace and quickly jump back to another branch (in order to merge into Master for example) then Xcode will complain that the files have changed and probably crash too.
From what I gather, I can’t add these files to my .gitignore either.
Do I have to accept that a concise and orderly git strategy is not possible with Xcode, close Xcode before doing any Git management, or is there another option available?
I just add those files to my
.gitignorefile. There is no need to share them with other developers.So I have:
In .gitignore
Note that the stackoverflow question you linked to says to not exclude
project.pbxproj, but it doesn’t say not to exclude*.xcworkspace.However, I’m not using the workspace feature at this time. If you do use the workspace feature you may want to include those files, but ignore the
xcuserdatafiles.