![](/img/trans.png)
[英]xCode TFS git Reposity - not able to pull changes when uncommited changes
[英]Cannot push, pull or merge git. “Working copy has uncommited changes”
我最近在bitbucket上建立了一个git存储库,并在其中添加了一个旧项目。 我已经提交并推动了一项更改作为测试,但是现在我遇到了这个问题。
每次尝试拉,推或合并时,都会出现以下错误消息:
“工作副本'Project_Name'具有未提交的更改”。
我已多次做出此更改:
编辑 :我做了'git status'并得到以下内容:
# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: Crunch.xcodeproj/project.xcworkspace/xcuserdata/Neil.xcuserdatad/UserInterfaceState.xcuserstate
#
no changes added to commit (use "git add" and/or "git commit -a")
谢谢您的帮助,SirKaydian
步骤1:
git rm --cached ProjectName.xcodeproj/project.xcworkspace/xcuserdata/username.xcuserdatad/UserInterfaceState.xcuserstate
第2步:
git commit -m "Removed file that shouldn't be tracked"
好吧,原来我只需要发表评论
//THIS IS A TEST
并提交。 现在工作正常。 这肯定是一些奇怪的错误。
谢谢您的帮助,SirKaydian
我不熟悉.xcuserstate
文件,但听起来像是用户特定的文件。 通常,特定于用户的文件与源代码管理无关。 它们经常更改,通常是二进制的,因此很难区分,对其他用户没有帮助。 尝试关闭IDE,然后运行命令,或尝试将此文件名添加到.gitignore
文件中。
我通过以下方法解决了这个问题:
git push <remote> localbranch --force.
除非您完全确定自己知道自己在做什么,否则不要使用--force标志。
git rm --cached *.xcuserstate *.xcuserdata
运行上面的命令。 然后提交,然后推送。
参见此处: 每当我尝试git pull或push时,Xcode都会说“ Uncommitted Changes”
您可能需要单独运行它们:
git rm --cached *.xcuserstate
git rm --cached *.xcuserdata
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.