Cannot push, pull or merge git. “Working copy has uncommited changes”

和自甴很熟 提交于 2019-11-28 19:52:48
Gangcil

Step 1:

git rm --cached ProjectName.xcodeproj/project.xcworkspace/xcuserdata/username.xcuserdatad/UserInterfaceState.xcuserstate

Step 2:

git commit -m "Removed file that shouldn't be tracked"

Okay, turns out I just had to make a comment

//THIS IS A TEST

And commit that. Now it works fine. This must have just been some strange bug.

Thanks for the help though, SirKaydian

I'm unfamiliar with the .xcuserstate file, but it sounds like a user-specific file. Generally user-specific files have no business in source control. They change frequently, generally are binary and thus difficult to diff, and aren't helpful to other users. Try closing down your IDE then running the commands or try adding this file name to your .gitignore file.

I solved this problem by:

git push <remote> localbranch --force.

Do not use the --force flag unless you’re absolutely sure you know what you’re doing.

MobileMon
git rm --cached *.xcuserstate *.xcuserdata

Run the above command. Then commit, then push.

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

You may need to run them separately :

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