Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode says "Uncommitted Changes" Whenever I try to git pull or push

I am using git in my projects, whenever I try to pull from Xcode I get "Uncommitted Changes" and it prevents me from pulling/pushing. I try to commit and find one file with extension *.xcuserstate, this file is modified whenever I open/scroll into any project file in Xcode. That leaves me no option but to do a single commit that contains that file, which fill the git commit logs with meaningless commits.

Is this there is a way to stop this behavior?

I tried to put *.xcuserstate and xcuserdata into git ignore but that caused Xcode to crash every time I try to pull.

This happens with Xcode 4.2 and 4.3

like image 716
Muhammad Hassan Nasr Avatar asked Jun 23 '12 21:06

Muhammad Hassan Nasr


2 Answers

Normally you don't want to put the *.xcuserstate and *.xcuserdata files into your Git repository. These files aren't really part of your project, but are just a place where Xcode stores its local information that is helpful when reloading your project.

You can fix this by using:

git rm --cached *.xcuserstate *.xcuserdata

and then committing the result. This will remove those files from the repository without removing them from your working directory.

like image 104
Greg Hewgill Avatar answered Nov 19 '22 11:11

Greg Hewgill


If this is a settings file which is different for every developer, you probably don't need to version control it, just remove it from Git.

If that is not an option, you can Git Stash Save your changes before pulling and Git Stash pop to apply them again.

like image 45
Usman Avatar answered Nov 19 '22 10:11

Usman