Git - Mergetool
Table of Contents
About
The mergetool is a software that resolves a Git conflict.
Articles Related
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"
- for vscode
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):