uTools-Manuals/docs/git/git mergetool.html
2019-04-08 23:22:26 +08:00

1 line
5.2 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="c-markdown doc-markdown"><div class="doc-postil"><div class="c-markdown"><h2>Name</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>git-mergetool  - 运行合并冲突解决工具来解决合并冲突</p></div></div><div class="doc-postil"><div class="c-markdown"><h2>概要</h2></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">git mergetool [--tool=&lt;tool&gt;] [-y | --[no-]prompt] [&lt;file&gt;…]</pre></div></div><div class="doc-postil"><div class="c-markdown"><h2>描述</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>使用<code>git mergetool</code>运行的几种合并一个实用程序来解决合并冲突。它通常在之后运行<code>git merge</code></p></div></div><div class="doc-postil"><div class="c-markdown"><p>如果给出一个或多个&lt;file&gt;参数,则将运行合并工具程序以解决每个文件上的差异(跳过那些没有冲突的文件)。指定一个目录将包含该路径中所有未解析的文件。如果未指定&lt;文件&gt;名称,<code>git mergetool</code>则会在每个存在合并冲突的文件上运行合并工具程序。</p></div></div><div class="doc-postil"><div class="c-markdown"><h2>选项</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>-t &lt;tool&gt;   --tool=&lt;tool&gt;</p></div></div><div class="doc-postil"><div class="c-markdown"><p>使用&lt;tool&gt;指定的合并解析程序。有效值包括emergegvimdiffkdiff3meldvimdiff和tortoisemerge。运行<code>git mergetool --tool-help</code>有效的&lt;工具&gt;设置列表。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>如果没有指定合并解析程序,<code>git mergetool</code>将使用配置变量<code>merge.tool</code>。如果配置变量<code>merge.tool</code>没有设置,<code>git mergetool</code>会选择一个合适的默认值。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>您可以通过设置配置变量明确提供工具的完整路径<code>mergetool.&lt;tool&gt;.path</code>。例如您可以通过设置配置kdiff3的绝对路径<code>mergetool.kdiff3.path</code>。否则,<code>git mergetool</code>假定该工具在PATH中可用。</p></div></div><div class="doc-postil"><div class="c-markdown"><p><code>git mergetool</code>可以通过指定要在配置变量中调用的命令行来定制运行其他程序,而不是运行其中一个已知的合并工具程序<code>mergetool.&lt;tool&gt;.cmd</code></p></div></div><div class="doc-postil"><div class="c-markdown"><p><code>git mergetool</code>使用此工具调用此工具时(通过<code>-t</code><code>--tool</code>选项或<code>merge.tool</code>配置变量),将调用已配置的命令行并将其<code>$BASE</code>设置为包含合并公共基础的临时文件的名称(如果可用); <code>$LOCAL</code>设置为包含当前分支上文件内容的临时文件的名称; <code>$REMOTE</code>设置为包含要合并的文件内容的临时文件的名称,并将其<code>$MERGED</code>设置为合并工具应写入合并解析结果的文件的名称。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>如果自定义合并工具使用其退出代码正确指示合并分辨率的成功,则可将该配置变量<code>mergetool.&lt;tool&gt;.trustExitCode</code>设置为<code>true</code>。否则,<code>git mergetool</code>将在用户工具退出后提示用户指示解析成功。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>--tool-help</p></div></div><div class="doc-postil"><div class="c-markdown"><p>打印可能使用的合并工具列表<code>--tool</code></p></div></div><div class="doc-postil"><div class="c-markdown"><p>-y   --no-prompt</p></div></div><div class="doc-postil"><div class="c-markdown"><p>在每次调用合并解析程序之前不要提示。如果通过<code>--tool</code>选项或<code>merge.tool</code>配置变量显式指定合并解析程序,则这是默认值。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>--prompt</p></div></div><div class="doc-postil"><div class="c-markdown"><p>在每次调用合并解决方案之前提示,以使用户有机会跳过该路径。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>-O&lt;orderfile&gt;</p></div></div><div class="doc-postil"><div class="c-markdown"><p>按照&lt;orderfile&gt;中指定的顺序处理文件每行有一个shell glob模式。这覆盖了<code>diff.orderFile</code>配置变量请参阅git-config [1])。取消<code>diff.orderFile</code>,使用<code>-O/dev/null</code></p></div></div><div class="doc-postil"><div class="c-markdown"><h2>临时文件</h2></div></div><div class="doc-postil"><div class="c-markdown"><p><code>git mergetool*.orig</code>在解析合并时创建备份文件。一旦文件合并并且<code>git mergetool</code>会话完成,这些文件就可以安全移除。</p></div></div><div class="doc-postil"><div class="c-markdown"><p><code>mergetool.keepBackup</code>配置变量设置为<code>false</code>导致<code>git mergetool</code>在文件成功合并时自动删除备份。</p></div></div></div>