GIT-DIFFTOOL(1)

πŸ’… GIT-DIFFTOOL(1) πŸ’…

okay so bestie, welcome to git-difftool β€” this is the page straight out of the Git manual (you're in the GIT-DIFFTOOL(1) section, iykyk), and honestly? it's giving "let me show you your changes in literally any diff tool you want" energy. let's go 🫢


✨ NAME ✨

git-difftool β€” show changes using common diff tools


🌸 SYNOPSIS 🌸

git difftool [<options>] [<commit> [<commit>]] [--] [<path>...]

πŸ¦‹ DESCRIPTION πŸ¦‹

git difftool is a Git command that lets you compare and edit files between revisions using common diff tools. no cap, that's the whole vibe.

it's a frontend to git diff β€” so it accepts the same options and arguments. see git-diff(1) for the tea on those. πŸ’–


πŸŽ€ OPTIONS πŸŽ€

  • -d, --dir-diff β€” copies the modified files to a temporary location and does a whole directory diff on them. and heads up: this mode never prompts before launching the diff tool. like, it just goes. πŸƒβ€β™€οΈ
  • -y, --no-prompt β€” do not prompt before launching a diff tool. zero questions asked.
  • --prompt β€” prompt before each invocation of the diff tool. this is the default behaviour, btw β€” the option exists purely so you can override any configuration settings that say otherwise.
  • --rotate-to=<file> β€” start showing the diff for <file>, and the paths before it get moved to the end and output. cute lil carousel, lowkey. 🎠
  • --skip-to=<file> β€” start showing the diff for <file>, skipping all the paths before it entirely. bye bestie πŸ‘‹
  • -t <tool>, --tool=<tool> β€” use the diff tool specified by <tool>. valid values include emerge, kompare, meld, and vimdiff. run git difftool --tool-help for the list of valid <tool> settings. so helpful of it.

if a diff tool is not specified, git difftool will use the configuration variable diff.tool. if diff.tool is not set either, git difftool will pick a suitable default. it's got you. 🫢

you can explicitly provide a full path to the tool by setting the configuration variable difftool.<tool>.path. for example, you can configure the absolute path to kdiff3 by setting difftool.kdiff3.path. otherwise, git difftool assumes the tool is available in PATH.

instead of running one of the known diff tools, git difftool can be customized to run an alternative program by specifying the command line to invoke in a configuration variable difftool.<tool>.cmd.

when git difftool is invoked with this tool (either through the -t or --tool option or the diff.tool configuration variable) the configured command line will be invoked with the following variables available: $LOCAL is set to the name of the temporary file containing the contents of the diff pre-image and $REMOTE is set to the name of the temporary file containing the contents of the diff post-image. $MERGED is the name of the file which is being compared. $BASE is provided for compatibility with custom merge tool commands and has the same value as $MERGED. periodt. πŸ’…

  • --tool-help β€” print a list of diff tools that may be used with --tool. the menu, basically. πŸ“‹
  • --symlinks, --no-symlinks β€” git difftool's default behavior is to create symlinks to the working tree when run in --dir-diff mode and the right-hand side of the comparison yields the same content as the file in the working tree.

specifying --no-symlinks instructs git difftool to create copies instead. and --no-symlinks is the default on Windows. πŸͺŸ

  • -x <command>, --extcmd=<command> β€” specify a custom command for viewing diffs. git-difftool ignores the configured defaults and runs <command> $LOCAL $REMOTE when this option is specified. additionally, $BASE is set in the environment. main character command energy, honestly. πŸ‘‘
  • -g, --gui, --no-gui β€” when git-difftool is invoked with the -g or --gui option, the default diff tool will be read from the configured diff.guitool variable instead of diff.tool. this may be selected automatically using the configuration variable difftool.guiDefault. the --no-gui option can be used to override these settings. if diff.guitool is not set, we will fallback in the order of merge.guitool, diff.tool, merge.tool until a tool is found. it's a whole search party πŸ”
  • --trust-exit-code, --no-trust-exit-code β€” errors reported by the diff tool are ignored by default. 😬 use --trust-exit-code to make git-difftool exit when an invoked diff tool returns a non-zero exit code.

git-difftool will forward the exit code of the invoked tool when --trust-exit-code is used.

see git-diff(1) for the full list of supported options.


🌈 CONFIGURATION 🌈

git difftool falls back to git mergetool config variables when the difftool equivalents have not been defined. it's very "oh no you didn't set it, that's fine, i know a guy" of it.

everything above this line in this section isn't included from the git-config(1) documentation. the content that follows is the same as what's found there:
  • diff.tool β€” controls which diff tool is used by git-difftool(1). this variable overrides the value configured in merge.tool. the list below shows the valid built-in values. any other value is treated as a custom diff tool and requires that a corresponding difftool.<tool>.cmd variable is defined.
  • diff.guitool β€” controls which diff tool is used by git-difftool(1) when the -g/--gui flag is specified. this variable overrides the value configured in merge.guitool. the list below shows the valid built-in values. any other value is treated as a custom diff tool and requires that a corresponding difftool.<guitool>.cmd variable is defined.

🧚 the built-in tool roster (a vibe check)

  • araxis β€” use Araxis Merge (requires a graphical session)
  • bc β€” use Beyond Compare (requires a graphical session)
  • bc3 β€” use Beyond Compare (requires a graphical session)
  • bc4 β€” use Beyond Compare (requires a graphical session)
  • codecompare β€” use Code Compare (requires a graphical session)
  • deltawalker β€” use DeltaWalker (requires a graphical session)
  • diffmerge β€” use DiffMerge (requires a graphical session)
  • diffuse β€” use Diffuse (requires a graphical session)
  • ecmerge β€” use ECMerge (requires a graphical session)
  • emerge β€” use Emacs' Emerge
  • examdiff β€” use ExamDiff Pro (requires a graphical session)
  • guiffy β€” use Guiffy's Diff Tool (requires a graphical session)
  • gvimdiff β€” use gVim (requires a graphical session)
  • kdiff3 β€” use KDiff3 (requires a graphical session)
  • kompare β€” use Kompare (requires a graphical session)
  • meld β€” use Meld (requires a graphical session)
  • nvimdiff β€” use Neovim
  • opendiff β€” use FileMerge (requires a graphical session)
  • p4merge β€” use HelixCore P4Merge (requires a graphical session)
  • smerge β€” use Sublime Merge (requires a graphical session)
  • tkdiff β€” use TkDiff (requires a graphical session)
  • vimdiff β€” use Vim
  • vscode β€” use Visual Studio Code (requires a graphical session)
  • winmerge β€” use WinMerge (requires a graphical session)
  • xxdiff β€” use xxdiff (requires a graphical session)

πŸ’œ the rest of the config besties

  • difftool.<tool>.cmd β€” specify the command to invoke the specified diff tool. the specified command is evaluated in shell with the following variables available: LOCAL is set to the name of the temporary file containing the contents of the diff pre-image and REMOTE is set to the name of the temporary file containing the contents of the diff post-image.

see the --tool=<tool> option in git-difftool(1) for more details.

  • difftool.<tool>.path β€” override the path for the given tool. this is useful in case your tool is not in the PATH. πŸ”Ž
  • difftool.trustExitCode β€” exit difftool if the invoked diff tool returns a non-zero exit status.

see the --trust-exit-code option in git-difftool(1) for more details.

  • difftool.prompt β€” prompt before each invocation of the diff tool.
  • difftool.guiDefault β€” set true to use the diff.guitool by default (equivalent to specifying the --gui argument), or auto to select diff.guitool or diff.tool depending on the presence of a DISPLAY environment variable value. the default is false, where the --gui argument must be provided explicitly for the diff.guitool to be used. ngl the auto one is kind of iconic ✨

⭐ SEE ALSO ⭐

  • git-diff(1) β€” show changes between commits, commit and working tree, etc
  • git-mergetool(1) β€” run merge conflict resolution tools to resolve merge conflicts
  • git-config(1) β€” get and set repository or global options

πŸ‘‘ GIT πŸ‘‘

part of the git(1) suite πŸ’–


and that's the whole page bestie!! mwah πŸ“

source + version + date, one last time, with love: Git 2.56.0, dated 2026-09-27, and this was the GIT-DIFFTOOL(1) page. slay, go diff something pretty πŸ’…βœ¨

πŸ“¦ where this page comes from