如何解决 xcode ui 中的 git pull 冲突
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10591999/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to resolve git pull conflicts in xcode ui
提问by Greg Svitak
I am using the Xcode repository GUI with the latest version of Xcode instead of the command line. I did an initial pull of the rep without a problem. I made some changes to the local files. At the same time, my other developer made some changes. I committed my changes to the local rep but needed his changes to do a proper build. We only have 1 branch.
我将 Xcode 存储库 GUI 与最新版本的 Xcode 一起使用,而不是命令行。我没有问题地对代表进行了初步拉动。我对本地文件做了一些更改。与此同时,我的另一个开发者做了一些改变。我向当地代表提交了我的更改,但需要他的更改才能进行适当的构建。我们只有1个分店。
I tried to pull and the Xcode UI reports 6 conflicts (which is what I would expect as I need the 6 files to do the proper build).
我试图拉,Xcode UI 报告 6 个冲突(这是我所期望的,因为我需要 6 个文件来进行正确的构建)。
My question is how to resolve the conflicts? I read online I should be able to use the left and right button at the bottom of screen to let me pick which file version. I went through all of the 6 files and used the proper buttons to choose which changes I wanted.
我的问题是如何解决冲突?我在线阅读我应该能够使用屏幕底部的左右按钮让我选择哪个文件版本。我浏览了所有 6 个文件并使用正确的按钮来选择我想要的更改。
However the Pull button in the lower right hand corner is disabled and greyed out.
然而,右下角的拉动按钮被禁用并呈灰色。
回答by James
Above the file listing of the commit screen are three icons, a directory view, a documents view and the last one which looks like some horizontal lines. When I had a similar issue, I found that clicking on these revealed other files I had not yet resolved.
在提交屏幕的文件列表上方是三个图标,一个目录视图、一个文档视图和最后一个看起来像一些水平线的图标。当我遇到类似问题时,我发现单击这些会显示我尚未解决的其他文件。
I resolved those I could although noted that some of these files included some .DS-Store 's which are hidden Apple (Desktop Services Store) files which have been noted elsewhere of causing git issues.
我解决了那些我可以解决的问题,尽管注意到其中一些文件包含一些 .DS-Store 的隐藏 Apple(桌面服务商店)文件,这些文件已在其他地方引起 git 问题。
I placed the .DS_Store into .gitignore using the instructions at How can I Remove .DS_Store files from a Git repository?
我按照如何从 Git 存储库中删除 .DS_Store 文件中的说明将 .DS_Store 放入 .gitignore 中?
That fixed it for me.
那为我修好了。
回答by Evan Stone
In my case, I just had more conflicts further down that I didn't see. Strangely, since using Xcode 6 this is the first time I've actually had to deal with conflicts -- and I made them! (on a different machine)
就我而言,我只是在更远的地方遇到了更多我没有看到的冲突。奇怪的是,自从使用 Xcode 6 以来,这是我第一次真正不得不处理冲突——我制造了它们!(在不同的机器上)
At any rate, just scrolling down a bit more revealed that there were more conflicts in the file and once I chose "right" or "left" (or "right then left"/"left then right"), the "Pull" button enabled and I was able to complete my pull...
无论如何,再向下滚动一点就会发现文件中存在更多冲突,一旦我选择了“右”或“左”(或“右然后左”/“左然后右”),“拉”按钮启用,我能够完成我的拉...
Whew! Hope this helps!
哇!希望这可以帮助!
回答by Charlyn Keating
For me, this was a file that had been deleted in the branch but was still present in Master. Once I unchecked that file, I was able to Pull.
对我来说,这是一个已在分支中删除但仍存在于 Master 中的文件。一旦我取消选中该文件,我就可以拉。
回答by Daniel Saner
I had this happen in Xcode 9.4.1, and what I needed to do, after having resolved all the conflicts, was the following:
我在 Xcode 9.4.1 中发生了这种情况,在解决了所有冲突后,我需要做的是:
- Switch to Source Control view in the left pane above the tree view (the box with a cross symbol in it)
- Toggle the checkbox next to the top-level project entry from off to on. This would enable the Pull button, but just for a second, not long enough to click it.
- Toggle the checkbox back to off, and back to on again. Now the Pull button remains enabled.
- Click Pull.
- 在树视图上方的左窗格中切换到源代码管理视图(其中带有十字符号的框)
- 将顶级项目条目旁边的复选框从关闭切换到打开。这将启用拉动按钮,但只是一秒钟,不足以单击它。
- 将复选框切换回关闭状态,然后再次打开。现在拉按钮保持启用状态。
- 单击拉。
This feels very much like a bug; I haven't verified yet if the issue persists, and the solution still works, in Xcode 10.
这感觉很像一个错误;我还没有验证问题是否仍然存在,并且解决方案在 Xcode 10 中仍然有效。
回答by user1055568
Just do "git pull" from the command line, then rebuild to find the conflict markers and fix them manually.
只需从命令行执行“git pull”,然后重建以找到冲突标记并手动修复它们。