Johan de Klerk
Johan de Klerk

Reputation: 2535

Xcode 4 and Branches

I am using Xcode 4.5 and Git for version control. I created a new branch and added some code to it. When I go to Organizer/My Repository and click on switch branch, I can't switch to a branch because I get the following error message :

Working copy is modified

Upvotes: 3

Views: 1068

Answers (3)

Jason Cheung
Jason Cheung

Reputation: 1

I came across the same problem yesterday, I simply go to the project directory, use these commands, and able to solve the problem. git add . and git commit -m "resolved working copy is modified"

Upvotes: -1

Johan de Klerk
Johan de Klerk

Reputation: 2535

Figured it out. I had to remove the xcuserstate and added it to my .gitignore

git rm --cached ProjectFolder.xcodeproj/project.xcworkspace/xcuserdata/myUserName.xcuserdatad/UserInterfaceState.xcuserstate
git commit -m "Removed file that shouldn't be tracked"

Upvotes: 7

Scott Berrevoets
Scott Berrevoets

Reputation: 16946

You have to commit changes to that branch first before you can switch branches.

Upvotes: 0

Related Questions