'\" t
.\"     Title: git-difftool
.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\"      Date: 02/26/2025
.\"    Manual: Git Manual
.\"    Source: Git 2.25.1
.\"  Language: English
.\"
.TH "GIT\-DIFFTOOL" "1" "02/26/2025" "Git 2\&.25\&.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 [<options>] [<commit> [<commit>]] [\-\-] [<path>\&...]
.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
\-t <tool>, \-\-tool=<tool>
.RS 4
Use the diff tool specified by <tool>\&. Valid values include emerge, kompare, meld, and vimdiff\&. Run
\fBgit difftool \-\-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\&.<tool>\&.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\&.<tool>\&.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 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
\fB$command $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\&. The
\fB\-\-no\-gui\fR
option can be used to override this setting\&. 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
\fIgit\-difftool\fR
invokes a diff tool individually on each file\&. 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 "CONFIG VARIABLES"
.sp
\fIgit difftool\fR falls back to \fIgit mergetool\fR config variables when the difftool equivalents have not been defined\&.
.PP
diff\&.tool
.RS 4
The default diff tool to use\&.
.RE
.PP
diff\&.guitool
.RS 4
The default diff tool to use when
\fB\-\-gui\fR
is specified\&.
.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\&.<tool>\&.cmd
.RS 4
Specify the command to invoke the specified diff tool\&.
.sp
See the
\fB\-\-tool=<tool>\fR
option above for more details\&.
.RE
.PP
difftool\&.prompt
.RS 4
Prompt before each invocation of the diff tool\&.
.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 above for more details\&.
.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
