Progress:
TIER 2 · MODULE 18· Intermediate

git difftool

Hands diffs to meld/vimdiff/etc.

🎯 What & why

git difftool hands diffs to an external viewer (meld, vimdiff, kdiff3, Beyond Compare, VS Code) instead of dumping unified diff to your terminal. Indispensable when the diff is bigger than your eyeballs.

🧠 Mental model

Same engine as git diff, different frontend. Whatever git diff would show, difftool ships to a configured GUI or TUI tool one file at a time - or the whole tree at once with -d.

🛠️ Synopsis

git difftool [--tool=<tool>] [-d|--dir-diff] [-y|--no-prompt]
                  [-x <command>] [--gui] [--trust-exit-code]
                  [<diff-options>] [<commit> [<commit>]] [--] [<path>...]

🎚️ Switches & options

FlagWhat it does
--tool=<tool>Pick the tool: meld, vimdiff, kdiff3, bc, vscode, etc.
-d, --dir-diffDiff entire working trees side-by-side instead of file-by-file
-y, --no-promptSkip the 'Launch tool?' prompt for every file
-x <command>Run an arbitrary command on each pair instead of a configured tool
--guiUse diff.guitool instead of diff.tool
--trust-exit-codeHonor the tool's exit code (so scripts can detect cancel)
difftool.<tool>.cmd (config)Define a custom command template using $LOCAL and $REMOTE

💡 Use cases

🧪 Examples

Whole-tree review with meld
git difftool -d -t meld main..feature
Skip per-file prompts
git difftool -y HEAD~3 HEAD
VS Code as gui tool
git difftool --gui -d
Ad-hoc tool via -x
git difftool -x "diff -u" HEAD~1

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

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