尝试合并隐藏代码时合并冲突

时间:2016-05-26 13:23:44

标签: xcode git github merge

所以我为我的Swift项目隐藏了我的更改,以便我可以发出拉取请求,然后将我所做的更改与新拉动合并。但是,每当我尝试合并我的更改时,我都会遇到关于UserInterfaceState.xcuserstate XCode文件的合并冲突。我正在尝试的任何东西都不允许我合并我的代码,我担心我会失去一个下午的代码。

我尝试将* .xcuserstate添加到.gitignore,但这似乎没有做任何事情。然后我尝试删除该文件,该文件从存储中的版本创建了修改/删除冲突。这是我在尝试获取存储代码时遇到的错误:

$ git stash apply
CONFLICT (modify/delete): myProj.xcodeproj/myProj.xcworkspace/xcuserdata/lnd.xcuserdatad/UserInterfaceState.xcuserstate deleted in Updated upstream and modified in Stashed changes. Version Stashed changes of myProj.xcodeproj/myProj.xcworkspace/xcuserdata/lnd.xcuserdatad/UserInterfaceState.xcuserstate left in tree.

尝试Flows推荐的这是我收到的输出:

$ git reset --hard
HEAD is now at e509ffa Fixed bugs
$ git stash pop
myProj.xcodeproj/myProj.xcworkspace/xcuserdata/lnd.xcuserdatad/UserInterfaceState.xcuserstate: needs merge
unable to refresh index

$ git rm myProj.xcodeproj/myProj.xcworkspace/xcuserdata/lnd.xcuserdatad/UserInterfaceState.xcuserstate
myProj.xcodeproj/myProj.xcworkspace/xcuserdata/lnd.xcuserdatad/UserInterfaceState.xcuserstate: needs merge
rm 'myProj.xcodeproj/myProj.xcworkspace/xcuserdata/lnd.xcuserdatad/UserInterfaceState.xcuserstate'
$ git stash pop
CONFLICT (modify/delete): myProj.xcodeproj/myProj.xcworkspace/xcuserdata/lnd.xcuserdatad/UserInterfaceState.xcuserstate deleted in Updated upstream and modified in Stashed changes. Version Stashed changes of myProj.xcodeproj/myProj.xcworkspace/xcuserdata/lnd.xcuserdatad/UserInterfaceState.xcuserstate left in tree.

我能做些什么来解决这个问题吗?似乎没有什么工作,所以任何帮助都将非常感谢,谢谢。

1 个答案:

答案 0 :(得分:1)

你可以试试这个

--hard选项重置为origin/master

使用stash pop

应用存储

Git应该告诉你存在冲突。编辑UserInterfaceState.xcuserstate文件以查看冲突并进行更正。

git commit

如果它不起作用,你可以粘贴命令的所有git输出吗?