Hands diffs to meld/vimdiff/etc.
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.
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.
git difftool [--tool=<tool>] [-d|--dir-diff] [-y|--no-prompt]
[-x <command>] [--gui] [--trust-exit-code]
[<diff-options>] [<commit> [<commit>]] [--] [<path>...]| Flag | What it does |
|---|---|
--tool=<tool> | Pick the tool: meld, vimdiff, kdiff3, bc, vscode, etc. |
-d, --dir-diff | Diff entire working trees side-by-side instead of file-by-file |
-y, --no-prompt | Skip the 'Launch tool?' prompt for every file |
-x <command> | Run an arbitrary command on each pair instead of a configured tool |
--gui | Use diff.guitool instead of diff.tool |
--trust-exit-code | Honor the tool's exit code (so scripts can detect cancel) |
difftool.<tool>.cmd (config) | Define a custom command template using $LOCAL and $REMOTE |
git difftool -d -t meld main..featuregit difftool -y HEAD~3 HEADgit difftool --gui -dgit difftool -x "diff -u" HEAD~1Hit each option, then Check answers. Score is recorded; Next is always open.