1
2
3
4
5
6
|
<h1>git-difftool</h1> <h2 id="_name">Name</h2> <div class="sectionbody"> <p>git-difftool - Show changes using common diff tools</p> </div> <h2 id="_synopsis">Synopsis</h2> <div class="sectionbody"> <div class="verseblock"> <pre class="content" data-language="shell">git difftool [<options>] [<commit> [<commit>]] [--] [<path>…]</pre> </div> </div> <h2 id="_description">Description</h2> <div class="sectionbody"> <p><code>git difftool</code> is a Git command that allows you to compare and edit files between revisions using common diff tools. <code>git difftool</code> is a frontend to <code>git diff</code> and accepts the same options and arguments. See <a href="git-diff">git-diff[1]</a>.</p> </div> <h2 id="_options">Options</h2> <div class="sectionbody"> <div class="dlist"> <dl> <dt class="hdlist1" id="Documentation/git-difftool.txt--d"> -d </dt> <dt class="hdlist1" id="Documentation/git-difftool.txt---dir-diff"> --dir-diff </dt> <dd> <p>Copy the modified files to a temporary location and perform a directory diff on them. This mode never prompts before launching the diff tool.</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt--y"> -y </dt> <dt class="hdlist1" id="Documentation/git-difftool.txt---no-prompt"> --no-prompt </dt> <dd> <p>Do not prompt before launching a diff tool.</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt---prompt"> --prompt </dt> <dd> <p>Prompt before each invocation of the diff tool. This is the default behaviour; the option is provided to override any configuration settings.</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt---rotate-toltfilegt"> --rotate-to=<file> </dt> <dd> <p>Start showing the diff for the given path, the paths before it will move to the end and output.</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt---skip-toltfilegt"> --skip-to=<file> </dt> <dd> <p>Start showing the diff for the given path, skipping all the paths before it.</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt--tlttoolgt"> -t <tool> </dt> <dt class="hdlist1" id="Documentation/git-difftool.txt---toollttoolgt"> --tool=<tool> </dt> <dd> <p>Use the diff tool specified by <tool>. Valid values include emerge, kompare, meld, and vimdiff. Run <code>git difftool --tool-help</code> for the list of valid <tool> settings.</p> <p>If a diff tool is not specified, <code>git difftool</code> will use the configuration variable <code>diff.tool</code>. If the configuration variable <code>diff.tool</code> is not set, <code>git difftool</code> will pick a suitable default.</p> <p>You can explicitly provide a full path to the tool by setting the configuration variable <code>difftool.<tool>.path</code>. For example, you can configure the absolute path to kdiff3 by setting <code>difftool.kdiff3.path</code>. Otherwise, <code>git difftool</code> assumes the tool is available in PATH.</p> <p>Instead of running one of the known diff tools, <code>git difftool</code> can be customized to run an alternative program by specifying the command line to invoke in a configuration variable <code>difftool.<tool>.cmd</code>.</p> <p>When <code>git difftool</code> is invoked with this tool (either through the <code>-t</code> or <code>--tool</code> option or the <code>diff.tool</code> configuration variable) the configured command line will be invoked with the following variables available: <code>$LOCAL</code> is set to the name of the temporary file containing the contents of the diff pre-image and <code>$REMOTE</code> is set to the name of the temporary file containing the contents of the diff post-image. <code>$MERGED</code> is the name of the file which is being compared. <code>$BASE</code> is provided for compatibility with custom merge tool commands and has the same value as <code>$MERGED</code>.</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt---tool-help"> --tool-help </dt> <dd> <p>Print a list of diff tools that may be used with <code>--tool</code>.</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt---no-symlinks"> --[no-]symlinks </dt> <dd> <p><code>git difftool</code>'s default behavior is to create symlinks to the working tree when run in <code>--dir-diff</code> mode and the right-hand side of the comparison yields the same content as the file in the working tree.</p> <p>Specifying <code>--no-symlinks</code> instructs <code>git difftool</code> to create copies instead. <code>--no-symlinks</code> is the default on Windows.</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt--xltcommandgt"> -x <command> </dt> <dt class="hdlist1" id="Documentation/git-difftool.txt---extcmdltcommandgt"> --extcmd=<command> </dt> <dd> <p>Specify a custom command for viewing diffs. <code>git-difftool</code> ignores the configured defaults and runs <code>$command $LOCAL $REMOTE</code> when this option is specified. Additionally, <code>$BASE</code> is set in the environment.</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt--g"> -g </dt> <dt class="hdlist1" id="Documentation/git-difftool.txt---no-gui"> --[no-]gui </dt> <dd> <p>When <code>git-difftool</code> is invoked with the <code>-g</code> or <code>--gui</code> option the default diff tool will be read from the configured <code>diff.guitool</code> variable instead of <code>diff.tool</code>. This may be selected automatically using the configuration variable <code>difftool.guiDefault</code>. The <code>--no-gui</code> option can be used to override these settings. If <code>diff.guitool</code> is not set, we will fallback in the order of <code>merge.guitool</code>, <code>diff.tool</code>, <code>merge.tool</code> until a tool is found.</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt---no-trust-exit-code"> --[no-]trust-exit-code </dt> <dd> <p><code>git-difftool</code> invokes a diff tool individually on each file. Errors reported by the diff tool are ignored by default. Use <code>--trust-exit-code</code> to make <code>git-difftool</code> exit when an invoked diff tool returns a non-zero exit code.</p> <p><code>git-difftool</code> will forward the exit code of the invoked tool when <code>--trust-exit-code</code> is used.</p> </dd> </dl> </div> <p>See <a href="git-diff">git-diff[1]</a> for the full list of supported options.</p> </div> <h2 id="_configuration">Configuration</h2> <div class="sectionbody"> <p><code>git difftool</code> falls back to <code>git mergetool</code> config variables when the difftool equivalents have not been defined.</p> <p>Everything above this line in this section isn’t included from the <a href="git-config">git-config[1]</a> documentation. The content that follows is the same as what’s found there:</p> <div class="dlist"> <dl> <dt class="hdlist1" id="Documentation/git-difftool.txt-difftool"> diff.tool </dt> <dd> <p>Controls which diff tool is used by <a href="git-difftool">git-difftool[1]</a>. This variable overrides the value configured in <code>merge.tool</code>. 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.</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt-diffguitool"> diff.guitool </dt> <dd> <p>Controls which diff tool is used by <a href="git-difftool">git-difftool[1]</a> when the -g/--gui flag is specified. This variable overrides the value configured in <code>merge.guitool</code>. 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.</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt-difftoollttoolgtcmd"> difftool.<tool>.cmd </dt> <dd> <p>Specify the command to invoke the specified diff tool. The specified command is evaluated in shell with the following variables available: <code>LOCAL</code> is set to the name of the temporary file containing the contents of the diff pre-image and <code>REMOTE</code> is set to the name of the temporary file containing the contents of the diff post-image.</p> <p>See the <code>--tool=<tool></code> option in <a href="git-difftool">git-difftool[1]</a> for more details.</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt-difftoollttoolgtpath"> difftool.<tool>.path </dt> <dd> <p>Override the path for the given tool. This is useful in case your tool is not in the PATH.</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt-difftooltrustExitCode"> difftool.trustExitCode </dt> <dd> <p>Exit difftool if the invoked diff tool returns a non-zero exit status.</p> <p>See the <code>--trust-exit-code</code> option in <a href="git-difftool">git-difftool[1]</a> for more details.</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt-difftoolprompt"> difftool.prompt </dt> <dd> <p>Prompt before each invocation of the diff tool.</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt-difftoolguiDefault"> difftool.guiDefault </dt> <dd> <p>Set <code>true</code> to use the <code>diff.guitool</code> by default (equivalent to specifying the <code>--gui</code> argument), or <code>auto</code> to select <code>diff.guitool</code> or <code>diff.tool</code> depending on the presence of a <code>DISPLAY</code> environment variable value. The default is <code>false</code>, where the <code>--gui</code> argument must be provided explicitly for the <code>diff.guitool</code> to be used.</p> </dd> </dl> </div> </div> <h2 id="_see_also">See also</h2> <div class="sectionbody"> <div class="dlist"> <dl> <dt class="hdlist1" id="Documentation/git-difftool.txt-ahrefdocsgit-diffgit-diff1a"> <a href="git-diff">git-diff[1]</a> </dt> <dd> <p>Show changes between commits, commit and working tree, etc</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt-ahrefdocsgit-mergetoolgit-mergetool1a"> <a href="git-mergetool">git-mergetool[1]</a> </dt> <dd> <p>Run merge conflict resolution tools to resolve merge conflicts</p> </dd> <dt class="hdlist1" id="Documentation/git-difftool.txt-ahrefdocsgit-configgit-config1a"> <a href="git-config">git-config[1]</a> </dt> <dd> <p>Get and set repository or global options</p> </dd> </dl> </div> </div><div class="_attribution">
<p class="_attribution-p">
© 2012–2024 Scott Chacon and others<br>Licensed under the MIT License.<br>
<a href="https://git-scm.com/docs/git-difftool" class="_attribution-link">https://git-scm.com/docs/git-difftool</a>
</p>
</div>
|