Progress:
TIER 2 · MODULE 05· Intermediate

git mergetool

Hands conflicts to vimdiff/meld/kdiff3/etc.

🎯 What & why

git mergetool shells out to an external 3-way merge tool for every unmerged path. When the conflict markers in your editor turn into a wall of <<<<<<<, this is the escape hatch.

🧠 Mental model

It's a driver, not a merger. Git already produced LOCAL, REMOTE, and BASE; mergetool just hands those three files to vimdiff/meld/kdiff3 and writes whatever you save back into the working tree.

🛠️ Synopsis

git mergetool [--tool=<tool>] [--tool-help] [-y|--no-prompt|--prompt]
              [-O<orderfile>] [--[no-]gui] [<file>...]

🎚️ Switches & options

FlagWhat it does
--tool=<tool>Pick a tool: vimdiff, meld, kdiff3, bc, opendiff, ...
--tool-helpList the merge tools Git knows how to drive on this box.
-y, --no-promptSkip the Hit return to start merge resolution tool prompt. Use this if you trust the tool.
-O <orderfile>Process conflicts in the order listed in <orderfile>. Handy for huge merges.
--gui / --no-guiHonor merge.guitool instead of merge.tool. Or don't.
--prompt⚠️ The default. Annoying when scripted; explicit when interactive.

💡 Use cases

🧪 Examples

List drivers Git ships with
git mergetool --tool-help
Resolve with meld, no prompts
git mergetool --tool=meld -y
Set a default and forget it
git config --global merge.tool kdiff3
git config --global mergetool.keepBackup false
git mergetool
Resolve only one path
git mergetool src/parser.c

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

Hit each option, then Check answers. Score is recorded; Next is always open.