git-difftool
Compare files using external diff tools
TLDR
List available diff tools
Set the default diff tool to meld
Use the default diff tool to show staged changes
Use a specific tool (opendiff) to show changes since a given commit
SYNOPSIS
git difftool [options] [commit]… [--no-index | --dir-diff] pathspec…
PARAMETERS
--tool=
Use specified diff tool (e.g., meld, vimdiff); lists available with git difftool --tool-help.
--extcmd=
Use custom external command for diffing two files.
--extcmd-config
Like --extcmd but reads command from difftool.<tool>.cmd config.
--dir-diff
Use tool's directory diff mode; implies one directory arg per side.
--no-index
Compare files not in Git index (e.g., arbitrary files/directories).
--no-prompt
Do not prompt before launching tool for each file.
--prompt
Prompt before each file (default).
--trust-exit-code
Respect exit code from per-file exit (advanced).
-y, --no-prompt
Synonym for --no-prompt.
--cached, --staged
Compare working dir/index to HEAD/index.
-R
Reverse diff direction.
--submodule[=
Control submodule diff recursion.
DESCRIPTION
git difftool launches an external diff tool to visually compare changes between Git trees, commits, files, or directories. Unlike git diff's text output, it opens graphical or console viewers like Meld, vimdiff, KDiff3, or Beyond Compare for easier spotting of differences.
It supports comparing:
• Working directory vs index (git difftool)
• Index vs HEAD (git difftool --cached)
• Two commits (git difftool commit1 commit2)
• Arbitrary paths (git difftool --no-index file1 file2)
• Directory diffs with --dir-diff.
Configure via git config diff.tool <tool> and difftool.<tool>.cmd. Prompts before each file by default; use --no-prompt to launch all. Inherits most git diff options for flexibility in staging, pathspecs, and more. Ideal for developers reviewing changes before commit or merge.
CAVEATS
Requires configured diff.tool or prompts for tool; some tools may not handle binary/large files well. Inherits git diff limitations on pathspecs. Not for real-time editing—use git mergetool for merges.
CONFIGURATION EXAMPLE
git config --global diff.tool meld
git config --global difftool.meld.cmd 'meld "$LOCAL" "$REMOTE"'
AVAILABLE TOOLS
Run git difftool --tool-help to list supported tools like ardiff, bc3, codecompare, deltawalker, diffuse, ecmerge, gvimdiff, kompare, meld, opendiff, p4merge, tkdiff, vimdiff, vimdifft3, winmerge.
HISTORY
Introduced in Git 1.6.1 (2008) to complement git diff with visual tools. Evolved with Git versions adding --dir-diff (1.7.2), --no-index support, and better config integration. Widely used in modern workflows for PR reviews and conflict resolution.
SEE ALSO
git diff(1), git mergetool(1), git config(1)


