Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 897
JTN Avatar asked Nov 30 '22 04:11

JTN


1 Answers

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.'

like image 150
icodebuster Avatar answered Dec 03 '22 22:12

icodebuster