'\" t
.\" Title: git-difftool
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 11/25/2024
.\" Manual: Git Manual
.\" Source: Git 2.47.1
.\" Language: English
.\"
.TH "GIT\-DIFFTOOL" "1" "11/25/2024" "Git 2\&.47\&.1" "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 [] [ []] [\-\-] [\&...]
.fi
.sp
.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=
.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=
.RS 4
Start showing the diff for the given path, skipping all the paths before it\&.
.RE
.PP
\-t , \-\-tool=
.RS 4
Use the diff tool specified by \&. Valid values include emerge, kompare, meld, and vimdiff\&. Run
\fBgit difftool \-\-tool\-help\fR
for the list of valid 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\&.\&.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\&.\&.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 , \-\-extcmd=
.RS 4
Specify a custom command for viewing diffs\&.
\fIgit\-difftool\fR
ignores the configured defaults and runs
\fB $LOCAL $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\&.\&.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\&.\&.cmd variable is defined\&.
.RE
.PP
difftool\&.\&.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
option in
\fBgit-difftool\fR(1)
for more details\&.
.RE
.PP
difftool\&.\&.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