JTN
JTN

Reputation: 239

UserInterfaceState.xcuserstate not getting committed while using git in Xcode

when I'm trying to commit my code project it shows a file called 'UserInterfaceState.xcuserstate' which has to be committed. once i commit it and try to push my project to git ,the Xcode gives me a popup message saying that 'The working copy "app" has uncommitted changes.' and when I try to commit again I get the same file 'UserInterfaceState.xcuserstate' to be committed again. Can anybody help me with this?

Upvotes: 6

Views: 4540

Answers (1)

icodebuster
icodebuster

Reputation: 8964

UserInterfaceState.xcuserstate is where Xcode saves your GUI states, such as window positions, open tabs, expanded nodes in the project inspector etc.

Simply resizing the Xcode window will cause this file to change and be flagged as modified by your source control system. You can make your SCM system ignore specific files that are not important to the project itself.

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 Now onwards you wont get a popup message saying that 'The working copy "app" has uncommitted changes.'

Upvotes: 28

Related Questions