Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use git mergetool's filemerge

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 =)

like image 921
xxjjnn Avatar asked Nov 01 '12 18:11

xxjjnn


People also ask

How do I use git Mergetool to resolve conflicts?

Concepts for resolving Git conflictsREMOTE - the head for files(s) from a remote location that you are trying to merge into your LOCAL branch. BASE - the common ancestor(s) of LOCAL and REMOTE . MERGED - the tag / HEAD object after the merge - this is saved as a new commit.

How do I use Apple FileMerge?

To do this, select all the files in the leftmost column (click on one and then hit Command-A to select all). Then select Combine Files from the Merge pop-up menu (or press Command-1). FileMerge will ask you for a new directory name, and then proceed to merge the two directories into a new one.

What is git Mergetool command?

DESCRIPTION. Use git mergetool to run one of several merge utilities to resolve merge conflicts. It is typically run after git merge. If one or more <file> parameters are given, the merge tool program will be run to resolve differences on each file (skipping those without conflicts).

How do I set up Mergetool?

git mergetool is fully configurable so you can pretty much chose your favourite tool. In brief, you can set a default mergetool by setting the user config variable merge. tool . If the merge tool is one of the ones supported natively by it you just have to set mergetool.


1 Answers

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.

like image 161
ArtOfWarfare Avatar answered Oct 13 '22 17:10

ArtOfWarfare