Xcode says “Uncommitted Changes” Whenever I try to

2019-04-21 10:42发布

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

2条回答
2楼-- · 2019-04-21 10:46

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.

查看更多
女痞
3楼-- · 2019-04-21 10:59

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.

查看更多
登录 后发表回答