58

The documentation is here: http://www.kernel.org/pub/software/scm/git/docs/git-mergetool.html A handy guide is here: http://ryanflorence.com/git-for-beginners/

However, neither of them explain how to use mergetool's filemerge.

The guide I read says "I hit enter and FileMerge pops up and I deal with the conflicts:" but it doesn't mention how to "deal with the conflicts".

When I run:

git mergetool 

:and then hit return as prompted, and the filemerge window opens showing all the merge conflicts, it only responds to the commands cmd+D and cmd+shift+D (which allow cycling through the conflicts). However, there doesn't seem to be a mention of how to, for each conflict, choose left/right/neither. The combo-box dropdown does not seem to do anything.

Have already looked at docs, guide, file system menu, and systematically pressed keys on the keyboard looking for a response =)

2
  • I'm getting a hunch that filemerge only shows the errors, and the way you fix them is manually with your own text editor. ie you aren't supposed to be able to edit things with filemerge.
    – xxjjnn
    Nov 2, 2012 at 9:54
  • 1
    @ClothSwort No, editing works fine in the bottom FileMerge window.
    – Quantum7
    Jul 2, 2013 at 20:54

1 Answer 1

125

I haven't found any official documentation for it, but here's the understanding I got from trial and error:

There's a split view with your two options on the left and right. You can't edit either of those. There's also a bottom view which you can edit. You might need to pull up on the little circle in the middle of the bottom of the screen to expand that section.

For each conflict, click on the area in middle of the left/right split view and choose from the drop down in the lower right either "Choose Left" if the left is what you want or "Choose Right" if that is what you want. If neither option is good, click "Choose Neither" and edit it in the bottom section.

There's an arrow in the middle column that will show whether you've chosen left or right by pointing at it. If you've chosen neither, the arrow will disappear. All three views scroll together using the scroll bar on the far right screen.

When you're done, click File > Save Merge from the menubar.

11
  • 22
    Thanks for the pointers: it's a woefully unintuitive tool. The bottom panel was a great discovery. I found the best way to navigate to the next conflict was using the up/down arrow keys. Aug 14, 2014 at 22:17
  • 7
    Good call on the tiny circle located at the bottom ... didn't even notice it until reading your posting. Thanks. Dec 3, 2014 at 0:00
  • 5
    Ah! The dragging the little circle up was what got me too.
    – Don
    Mar 4, 2015 at 23:41
  • 5
    Something that confused me for a while: After you update the file to how you want it, or finish resolving the conflicts, you have to actually quit FileMerge to get the git mergetool to advance
    – Garrett
    Jan 8, 2016 at 17:40
  • 4
    Thanks @ArtOFWarfare ! Also wanted to add that if multiple files have conflicts, you have to save the merge, then quit the FileMerge program before the git merge tool will go to the next file and open it up in FileMerge. Jan 17, 2017 at 2:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.