Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use XCode's mergetool to resolve conflicts?

I'm in the middle of a rebase and I need to fix some merge conflicts. When I open the file in XCode, I see the source control conflict markers (<<<<<<<, etc) in the file.

How can I use XCode's mergetool to resolve these conflicts in a graphical fashion? I'm looking for this screen:

enter image description here

like image 794
Mike Miller Avatar asked Feb 26 '19 15:02

Mike Miller


2 Answers

Pulling the answer from here

# 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

Then, when git tells you that there is a conflict, you can run git mergetool and it will open XCode's mergetool (like in the question's screenshot) and you can work through the conflict.

like image 142
Jason Lydon Avatar answered Oct 11 '22 03:10

Jason Lydon


The FileMerge tool is a separate application, which you can open from the Xcode menu:

enter image description here

like image 43
matt Avatar answered Oct 11 '22 03:10

matt