Git - Mergetool

About

The mergetool is a software that resolves a Git conflict.

Steps

Installation

You need to install a mergetool such as:

  • tortoisemerge (tip: make a copy of tortoiseGitMerge), emerge, vimdiff (default)
  • meld, opendiff, kdiff3, tkdiff, xxdiff, gvimdiff, diffuse, ecmerge, p4merge, araxis

See git mergetool –tool-help for a full list

Configuration

You can configure it

git config merge.tool tortoisemerge
git config merge.conflictstyle diff3
git config mergetool.prompt false
  • for meld
git config --global merge.tool meld
git config --global mergetool.meld.path "C:\Meld\Meld.exe"
git config --global merge.tool code

Open

You can open it then with:

git mergetool

Example of output where mergetool is not configured but will still open tortoisemerge as I have it already installed on my computer thanks to TortoiseGit

This message is displayed because 'merge.tool' is not configured.
See 'git mergetool --tool-help' or 'git help config' for more details.
'git mergetool' will now attempt to use one of the following tools:
tortoisemerge emerge vimdiff
Merging:
syntax.php

Normal merge conflict for 'syntax.php':
  {local}: modified file
  {remote}: modified file
Hit return to start merge resolution tool (tortoisemerge):





Discover More
Git - Conflict resolution

In case of conflict during a merge, the working tree files will include a description of the conflict bracketed by the usual conflict markers <<<<<<< and >>>>>>>. For the marker, Git uses the same style...
Git - difftool

This article is the difftool configuration. Is there a diff with the mergetool? meld on linux WinMerge or p4merge on windows git difftool --tool= may be set to one of the following:...



Share this page:
Follow us:
Task Runner