Xcode Can’t Ignore UserInterfaceState.xcuserstate

Running version control in Xcode can give some troubles when setting up in an existing project. Having an existing project added to a new Git repository the Xcode keep saying UserInterfaceState.xcuserstate has changes.

The working copy “helloworld” has uncommitted changes. Commit or discard the changes and try again.

xcode_gitpush

Committing the changes doesn’t help as it keep saying there is uncommitted changes.

xcode_gitcommit

You want Git to ignore the file, you can add it to the .gitignore file, but you have to remove the tracking. To stop tracking a file that is currently tracked, use git rm –cached.

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

Afterwards the .gitignore will take effect of UserInterfaceState.xcuserstate

Posted in ErrorFix, Mac Tagged with: , , ,