git-difftool.1 (10215B)
- '\" t
- .\" Title: git-difftool
- .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
- .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
- .\" Date: 2025-03-14
- .\" Manual: Git Manual
- .\" Source: Git 2.49.0
- .\" Language: English
- .\"
- .TH "GIT\-DIFFTOOL" "1" "2025-03-14" "Git 2\&.49\&.0" "Git Manual"
- .\" -----------------------------------------------------------------
- .\" * Define some portability stuff
- .\" -----------------------------------------------------------------
- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- .\" http://bugs.debian.org/507673
- .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- .ie \n(.g .ds Aq \(aq
- .el .ds Aq '
- .\" -----------------------------------------------------------------
- .\" * set default formatting
- .\" -----------------------------------------------------------------
- .\" disable hyphenation
- .nh
- .\" disable justification (adjust text to left margin only)
- .ad l
- .\" -----------------------------------------------------------------
- .\" * MAIN CONTENT STARTS HERE *
- .\" -----------------------------------------------------------------
- .SH "NAME"
- git-difftool \- Show changes using common diff tools
- .SH "SYNOPSIS"
- .sp
- .nf
- \fIgit difftool\fR [<options>] [<commit> [<commit>]] [\-\-] [<path>\&...\:]
- .fi
- .SH "DESCRIPTION"
- .sp
- \fIgit difftool\fR is a Git command that allows you to compare and edit files between revisions using common diff tools\&. \fIgit difftool\fR is a frontend to \fIgit diff\fR and accepts the same options and arguments\&. See \fBgit-diff\fR(1)\&.
- .SH "OPTIONS"
- .PP
- \-d, \-\-dir\-diff
- .RS 4
- Copy the modified files to a temporary location and perform a directory diff on them\&. This mode never prompts before launching the diff tool\&.
- .RE
- .PP
- \-y, \-\-no\-prompt
- .RS 4
- Do not prompt before launching a diff tool\&.
- .RE
- .PP
- \-\-prompt
- .RS 4
- Prompt before each invocation of the diff tool\&. This is the default behaviour; the option is provided to override any configuration settings\&.
- .RE
- .PP
- \-\-rotate\-to=<file>
- .RS 4
- Start showing the diff for the given path, the paths before it will move to the end and output\&.
- .RE
- .PP
- \-\-skip\-to=<file>
- .RS 4
- Start showing the diff for the given path, skipping all the paths before it\&.
- .RE
- .PP
- \-t <tool>, \-\-tool=<tool>
- .RS 4
- Use the diff tool specified by <tool>\&. Valid values include emerge, kompare, meld, and vimdiff\&. Run
- \fBgit\fR
- \fBdifftool\fR
- \fB\-\-tool\-help\fR
- for the list of valid <tool> settings\&.
- .sp
- If a diff tool is not specified,
- \fIgit difftool\fR
- will use the configuration variable
- \fBdiff\&.tool\fR\&. If the configuration variable
- \fBdiff\&.tool\fR
- is not set,
- \fIgit difftool\fR
- will pick a suitable default\&.
- .sp
- You can explicitly provide a full path to the tool by setting the configuration variable
- \fBdifftool\&.\fR\fI<tool>\fR\fB\&.path\fR\&. For example, you can configure the absolute path to kdiff3 by setting
- \fBdifftool\&.kdiff3\&.path\fR\&. Otherwise,
- \fIgit difftool\fR
- assumes the tool is available in PATH\&.
- .sp
- Instead of running one of the known diff tools,
- \fIgit difftool\fR
- can be customized to run an alternative program by specifying the command line to invoke in a configuration variable
- \fBdifftool\&.\fR\fI<tool>\fR\fB\&.cmd\fR\&.
- .sp
- When
- \fIgit difftool\fR
- is invoked with this tool (either through the
- \fB\-t\fR
- or
- \fB\-\-tool\fR
- option or the
- \fBdiff\&.tool\fR
- configuration variable) the configured command line will be invoked with the following variables available:
- \fB$LOCAL\fR
- is set to the name of the temporary file containing the contents of the diff pre\-image and
- \fB$REMOTE\fR
- is set to the name of the temporary file containing the contents of the diff post\-image\&.
- \fB$MERGED\fR
- is the name of the file which is being compared\&.
- \fB$BASE\fR
- is provided for compatibility with custom merge tool commands and has the same value as
- \fB$MERGED\fR\&.
- .RE
- .PP
- \-\-tool\-help
- .RS 4
- Print a list of diff tools that may be used with
- \fB\-\-tool\fR\&.
- .RE
- .PP
- \-\-[no\-]symlinks
- .RS 4
- \fIgit difftool\fR\*(Aqs default behavior is to create symlinks to the working tree when run in
- \fB\-\-dir\-diff\fR
- mode and the right\-hand side of the comparison yields the same content as the file in the working tree\&.
- .sp
- Specifying
- \fB\-\-no\-symlinks\fR
- instructs
- \fIgit difftool\fR
- to create copies instead\&.
- \fB\-\-no\-symlinks\fR
- is the default on Windows\&.
- .RE
- .PP
- \-x <command>, \-\-extcmd=<command>
- .RS 4
- Specify a custom command for viewing diffs\&.
- \fIgit\-difftool\fR
- ignores the configured defaults and runs
- \fI<command>\fR
- \fB$LOCAL\fR
- \fB$REMOTE\fR
- when this option is specified\&. Additionally,
- \fB$BASE\fR
- is set in the environment\&.
- .RE
- .PP
- \-g, \-\-[no\-]gui
- .RS 4
- When
- \fIgit\-difftool\fR
- is invoked with the
- \fB\-g\fR
- or
- \fB\-\-gui\fR
- option the default diff tool will be read from the configured
- \fBdiff\&.guitool\fR
- variable instead of
- \fBdiff\&.tool\fR\&. This may be selected automatically using the configuration variable
- \fBdifftool\&.guiDefault\fR\&. The
- \fB\-\-no\-gui\fR
- option can be used to override these settings\&. If
- \fBdiff\&.guitool\fR
- is not set, we will fallback in the order of
- \fBmerge\&.guitool\fR,
- \fBdiff\&.tool\fR,
- \fBmerge\&.tool\fR
- until a tool is found\&.
- .RE
- .PP
- \-\-[no\-]trust\-exit\-code
- .RS 4
- Errors reported by the diff tool are ignored by default\&. Use
- \fB\-\-trust\-exit\-code\fR
- to make
- \fIgit\-difftool\fR
- exit when an invoked diff tool returns a non\-zero exit code\&.
- .sp
- \fIgit\-difftool\fR
- will forward the exit code of the invoked tool when
- \fB\-\-trust\-exit\-code\fR
- is used\&.
- .RE
- .sp
- See \fBgit-diff\fR(1) for the full list of supported options\&.
- .SH "CONFIGURATION"
- .sp
- \fIgit difftool\fR falls back to \fIgit mergetool\fR config variables when the difftool equivalents have not been defined\&.
- .sp
- Everything above this line in this section isn\(cqt included from the \fBgit-config\fR(1) documentation\&. The content that follows is the same as what\(cqs found there:
- .PP
- diff\&.tool
- .RS 4
- Controls which diff tool is used by
- \fBgit-difftool\fR(1)\&. This variable overrides the value configured in
- \fBmerge\&.tool\fR\&. 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\&.
- .RE
- .PP
- diff\&.guitool
- .RS 4
- Controls which diff tool is used by
- \fBgit-difftool\fR(1)
- when the \-g/\-\-gui flag is specified\&. This variable overrides the value configured in
- \fBmerge\&.guitool\fR\&. 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\&.
- .PP
- \fBaraxis\fR
- .RS 4
- Use Araxis Merge (requires a graphical session)
- .RE
- .PP
- \fBbc\fR
- .RS 4
- Use Beyond Compare (requires a graphical session)
- .RE
- .PP
- \fBbc3\fR
- .RS 4
- Use Beyond Compare (requires a graphical session)
- .RE
- .PP
- \fBbc4\fR
- .RS 4
- Use Beyond Compare (requires a graphical session)
- .RE
- .PP
- \fBcodecompare\fR
- .RS 4
- Use Code Compare (requires a graphical session)
- .RE
- .PP
- \fBdeltawalker\fR
- .RS 4
- Use DeltaWalker (requires a graphical session)
- .RE
- .PP
- \fBdiffmerge\fR
- .RS 4
- Use DiffMerge (requires a graphical session)
- .RE
- .PP
- \fBdiffuse\fR
- .RS 4
- Use Diffuse (requires a graphical session)
- .RE
- .PP
- \fBecmerge\fR
- .RS 4
- Use ECMerge (requires a graphical session)
- .RE
- .PP
- \fBemerge\fR
- .RS 4
- Use Emacs\*(Aq Emerge
- .RE
- .PP
- \fBexamdiff\fR
- .RS 4
- Use ExamDiff Pro (requires a graphical session)
- .RE
- .PP
- \fBguiffy\fR
- .RS 4
- Use Guiffy\(cqs Diff Tool (requires a graphical session)
- .RE
- .PP
- \fBgvimdiff\fR
- .RS 4
- Use gVim (requires a graphical session)
- .RE
- .PP
- \fBkdiff3\fR
- .RS 4
- Use KDiff3 (requires a graphical session)
- .RE
- .PP
- \fBkompare\fR
- .RS 4
- Use Kompare (requires a graphical session)
- .RE
- .PP
- \fBmeld\fR
- .RS 4
- Use Meld (requires a graphical session)
- .RE
- .PP
- \fBnvimdiff\fR
- .RS 4
- Use Neovim
- .RE
- .PP
- \fBopendiff\fR
- .RS 4
- Use FileMerge (requires a graphical session)
- .RE
- .PP
- \fBp4merge\fR
- .RS 4
- Use HelixCore P4Merge (requires a graphical session)
- .RE
- .PP
- \fBsmerge\fR
- .RS 4
- Use Sublime Merge (requires a graphical session)
- .RE
- .PP
- \fBtkdiff\fR
- .RS 4
- Use TkDiff (requires a graphical session)
- .RE
- .PP
- \fBvimdiff\fR
- .RS 4
- Use Vim
- .RE
- .PP
- \fBvscode\fR
- .RS 4
- Use Visual Studio Code (requires a graphical session)
- .RE
- .PP
- \fBwinmerge\fR
- .RS 4
- Use WinMerge (requires a graphical session)
- .RE
- .PP
- \fBxxdiff\fR
- .RS 4
- Use xxdiff (requires a graphical session)
- .RE
- .RE
- .PP
- difftool\&.<tool>\&.cmd
- .RS 4
- Specify the command to invoke the specified diff tool\&. The specified command is evaluated in shell with the following variables available:
- \fILOCAL\fR
- is set to the name of the temporary file containing the contents of the diff pre\-image and
- \fIREMOTE\fR
- is set to the name of the temporary file containing the contents of the diff post\-image\&.
- .sp
- See the
- \fB\-\-tool=\fR\fI<tool>\fR
- option in
- \fBgit-difftool\fR(1)
- for more details\&.
- .RE
- .PP
- difftool\&.<tool>\&.path
- .RS 4
- Override the path for the given tool\&. This is useful in case your tool is not in the PATH\&.
- .RE
- .PP
- difftool\&.trustExitCode
- .RS 4
- Exit difftool if the invoked diff tool returns a non\-zero exit status\&.
- .sp
- See the
- \fB\-\-trust\-exit\-code\fR
- option in
- \fBgit-difftool\fR(1)
- for more details\&.
- .RE
- .PP
- difftool\&.prompt
- .RS 4
- Prompt before each invocation of the diff tool\&.
- .RE
- .PP
- difftool\&.guiDefault
- .RS 4
- Set
- \fBtrue\fR
- to use the
- \fBdiff\&.guitool\fR
- by default (equivalent to specifying the
- \fB\-\-gui\fR
- argument), or
- \fBauto\fR
- to select
- \fBdiff\&.guitool\fR
- or
- \fBdiff\&.tool\fR
- depending on the presence of a
- \fBDISPLAY\fR
- environment variable value\&. The default is
- \fBfalse\fR, where the
- \fB\-\-gui\fR
- argument must be provided explicitly for the
- \fBdiff\&.guitool\fR
- to be used\&.
- .RE
- .SH "SEE ALSO"
- .PP
- \fBgit-diff\fR(1)
- .RS 4
- Show changes between commits, commit and working tree, etc
- .RE
- .PP
- \fBgit-mergetool\fR(1)
- .RS 4
- Run merge conflict resolution tools to resolve merge conflicts
- .RE
- .PP
- \fBgit-config\fR(1)
- .RS 4
- Get and set repository or global options
- .RE
- .SH "GIT"
- .sp
- Part of the \fBgit\fR(1) suite