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

巧了我就是萌 提交于 2019-12-10 03:16:58

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/11173261/xcode-says-uncommitted-changes-whenever-i-try-to-git-pull-or-push

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!