Merge Tools

Choosing a Merge Tool for Conflict Resolution

git mergetool opens each conflicted file in a tool showing your side, their side and the base beside the result, and stages the file when you save and quit. Git 1,932 knows dozens of tools and tells you which are installed:

Listing merge tools and choosing oneShell
git mergetool --tool-help | sed 's/^\s*//; s/ (.*//' |
  grep -E 'following|available|^(vimdiff|meld|kdiff3|vscode|p4merge|bc4|smerge) '
git config set --global merge.tool vscode
Output
'git mergetool --tool=<tool>' may be set to one of the following:
vimdiff          Use Vim with a custom layout
The following tools are valid, but not currently available:
bc4              Use Beyond Compare
kdiff3           Use KDiff3
meld             Use Meld
p4merge          Use HelixCore P4Merge
smerge           Use Sublime Merge
vscode           Use Visual Studio Code

Here, without a desktop, only vimdiff is available. vscode is known by name, so merge.tool vscode is all VS Code 550 needs; mergetool.keepBackup false stops Git leaving .orig copies behind.

Merge tools that git mergetool can launch
Tool Price and licence Platforms Three-way view
vimdiff, nvimdiff Free, open source Any terminal Yes
Meld 284,397 Free, GPL-2.0 Linux, Windows Yes
KDiff3 2,287 Free, GPL-2.0 Windows, macOS, Linux Yes, auto-merges
VS Code Free Windows, macOS, Linux Merge editor since 1.69 (2022)
P4Merge 27,942 Free, proprietary Windows, macOS, Linux Yes
Beyond Compare 5 98,393 $35 Standard, $70 Pro Windows, macOS, Linux Pro edition only
Sublime Merge 645,325 $99, three years of updates Windows, macOS, Linux Yes