如何使用 XCode 的合并工具解决冲突?

Mik*_*ler 8 merge xcode merge-conflict-resolution git-merge-conflict xcode10

我正处于变基中,我需要修复一些合并冲突。当我在 XCode 中打开文件时,我看到文件中的源代码控制冲突标记(<<<<<<< 等)。

如何使用 XCode 的合并工具以图形方式解决这些冲突?我正在寻找这个屏幕:

在此处输入图片说明

Jas*_*don 16

这里拉出答案

# Tell system where Xcode utilities live:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

# Set "opendiff" as the default mergetool globally:
git config --global merge.tool opendiff
Run Code Online (Sandbox Code Playgroud)

然后,当git告诉您存在冲突时,您可以运行git mergetool它并打开 XCode 的合并工具(如问题的屏幕截图所示),您可以解决冲突。


mat*_*att 5

FileMerge 工具是一个单独的应用程序,您可以从 Xcode 菜单中打开它:

在此处输入图片说明

  • 请注意,如果您使用的是 SourceTree 等外部图形 git 界面,则可以指定 FileMerge 作为图形合并工具。 (2认同)
  • 不过我确实喜欢你的回答。我不知道如何从 XCode 访问 FileMerge - 感谢分享!不幸的是,FileMerge 不是我正在寻找的工具。 (2认同)