man-pages/man1/git-difftool.1.html
2021-03-31 01:06:50 +01:00

306 lines
7.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of GIT-DIFFTOOL</TITLE>
</HEAD><BODY>
<H1>GIT-DIFFTOOL</H1>
Section: Git Manual (1)<BR>Updated: 03/04/2021<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
git-difftool - Show changes using common diff tools
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<P>
<PRE>
<I>git difftool</I> [&lt;options&gt;] [&lt;commit&gt; [&lt;commit&gt;]] [--] [&lt;path&gt;...]
</PRE>
<P>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
<I>git difftool</I> is a Git command that allows you to compare and edit files between revisions using common diff tools. <I>git difftool</I> is a frontend to <I>git diff</I> and accepts the same options and arguments. See <B><A HREF="/cgi-bin/man/man2html?1+git-diff">git-diff</A></B>(1).
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<P>
-d, --dir-diff
<DL COMPACT><DT id="1"><DD>
Copy the modified files to a temporary location and perform a directory diff on them. This mode never prompts before launching the diff tool.
</DL>
<P>
-y, --no-prompt
<DL COMPACT><DT id="2"><DD>
Do not prompt before launching a diff tool.
</DL>
<P>
--prompt
<DL COMPACT><DT id="3"><DD>
Prompt before each invocation of the diff tool. This is the default behaviour; the option is provided to override any configuration settings.
</DL>
<P>
-t &lt;tool&gt;, --tool=&lt;tool&gt;
<DL COMPACT><DT id="4"><DD>
Use the diff tool specified by &lt;tool&gt;. Valid values include emerge, kompare, meld, and vimdiff. Run
<B>git difftool --tool-help</B>
for the list of valid &lt;tool&gt; settings.
<P>
If a diff tool is not specified,
<I>git difftool</I>
will use the configuration variable
<B>diff.tool</B>. If the configuration variable
<B>diff.tool</B>
is not set,
<I>git difftool</I>
will pick a suitable default.
<P>
You can explicitly provide a full path to the tool by setting the configuration variable
<B>difftool.&lt;tool&gt;.path</B>. For example, you can configure the absolute path to kdiff3 by setting
<B>difftool.kdiff3.path</B>. Otherwise,
<I>git difftool</I>
assumes the tool is available in PATH.
<P>
Instead of running one of the known diff tools,
<I>git difftool</I>
can be customized to run an alternative program by specifying the command line to invoke in a configuration variable
<B>difftool.&lt;tool&gt;.cmd</B>.
<P>
When
<I>git difftool</I>
is invoked with this tool (either through the
<B>-t</B>
or
<B>--tool</B>
option or the
<B>diff.tool</B>
configuration variable) the configured command line will be invoked with the following variables available:
<B>$LOCAL</B>
is set to the name of the temporary file containing the contents of the diff pre-image and
<B>$REMOTE</B>
is set to the name of the temporary file containing the contents of the diff post-image.
<B>$MERGED</B>
is the name of the file which is being compared.
<B>$BASE</B>
is provided for compatibility with custom merge tool commands and has the same value as
<B>$MERGED</B>.
</DL>
<P>
--tool-help
<DL COMPACT><DT id="5"><DD>
Print a list of diff tools that may be used with
<B>--tool</B>.
</DL>
<P>
--[no-]symlinks
<DL COMPACT><DT id="6"><DD>
<I>git difftool</I>'s default behavior is create symlinks to the working tree when run in
<B>--dir-diff</B>
mode and the right-hand side of the comparison yields the same content as the file in the working tree.
<P>
Specifying
<B>--no-symlinks</B>
instructs
<I>git difftool</I>
to create copies instead.
<B>--no-symlinks</B>
is the default on Windows.
</DL>
<P>
-x &lt;command&gt;, --extcmd=&lt;command&gt;
<DL COMPACT><DT id="7"><DD>
Specify a custom command for viewing diffs.
<I>git-difftool</I>
ignores the configured defaults and runs
<B>$command $LOCAL $REMOTE</B>
when this option is specified. Additionally,
<B>$BASE</B>
is set in the environment.
</DL>
<P>
-g, --[no-]gui
<DL COMPACT><DT id="8"><DD>
When
<I>git-difftool</I>
is invoked with the
<B>-g</B>
or
<B>--gui</B>
option the default diff tool will be read from the configured
<B>diff.guitool</B>
variable instead of
<B>diff.tool</B>. The
<B>--no-gui</B>
option can be used to override this setting. If
<B>diff.guitool</B>
is not set, we will fallback in the order of
<B>merge.guitool</B>,
<B>diff.tool</B>,
<B>merge.tool</B>
until a tool is found.
</DL>
<P>
--[no-]trust-exit-code
<DL COMPACT><DT id="9"><DD>
<I>git-difftool</I>
invokes a diff tool individually on each file. Errors reported by the diff tool are ignored by default. Use
<B>--trust-exit-code</B>
to make
<I>git-difftool</I>
exit when an invoked diff tool returns a non-zero exit code.
<P>
<I>git-difftool</I>
will forward the exit code of the invoked tool when
<B>--trust-exit-code</B>
is used.
</DL>
<P>
See <B><A HREF="/cgi-bin/man/man2html?1+git-diff">git-diff</A></B>(1) for the full list of supported options.
<A NAME="lbAF">&nbsp;</A>
<H2>CONFIG VARIABLES</H2>
<P>
<I>git difftool</I> falls back to <I>git mergetool</I> config variables when the difftool equivalents have not been defined.
<P>
diff.tool
<DL COMPACT><DT id="10"><DD>
The default diff tool to use.
</DL>
<P>
diff.guitool
<DL COMPACT><DT id="11"><DD>
The default diff tool to use when
<B>--gui</B>
is specified.
</DL>
<P>
difftool.&lt;tool&gt;.path
<DL COMPACT><DT id="12"><DD>
Override the path for the given tool. This is useful in case your tool is not in the PATH.
</DL>
<P>
difftool.&lt;tool&gt;.cmd
<DL COMPACT><DT id="13"><DD>
Specify the command to invoke the specified diff tool.
<P>
See the
<B>--tool=&lt;tool&gt;</B>
option above for more details.
</DL>
<P>
difftool.prompt
<DL COMPACT><DT id="14"><DD>
Prompt before each invocation of the diff tool.
</DL>
<P>
difftool.trustExitCode
<DL COMPACT><DT id="15"><DD>
Exit difftool if the invoked diff tool returns a non-zero exit status.
<P>
See the
<B>--trust-exit-code</B>
option above for more details.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
<P>
<B><A HREF="/cgi-bin/man/man2html?1+git-diff">git-diff</A></B>(1)
<DL COMPACT><DT id="16"><DD>
Show changes between commits, commit and working tree, etc
</DL>
<P>
<B><A HREF="/cgi-bin/man/man2html?1+git-mergetool">git-mergetool</A></B>(1)
<DL COMPACT><DT id="17"><DD>
Run merge conflict resolution tools to resolve merge conflicts
</DL>
<P>
<B><A HREF="/cgi-bin/man/man2html?1+git-config">git-config</A></B>(1)
<DL COMPACT><DT id="18"><DD>
Get and set repository or global options
</DL>
<A NAME="lbAH">&nbsp;</A>
<H2>GIT</H2>
<P>
Part of the <B><A HREF="/cgi-bin/man/man2html?1+git">git</A></B>(1) suite
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="19"><A HREF="#lbAB">NAME</A><DD>
<DT id="20"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="21"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="22"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="23"><A HREF="#lbAF">CONFIG VARIABLES</A><DD>
<DT id="24"><A HREF="#lbAG">SEE ALSO</A><DD>
<DT id="25"><A HREF="#lbAH">GIT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:13 GMT, March 31, 2021
</BODY>
</HTML>