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

4 lines
4.9 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>名称</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>git-merge-file  - 运行三路文件合并</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 merge-file [-L &lt;current-name&gt; [-L &lt;base-name&gt; [-L &lt;other-name&gt;]]]        [--ours|--theirs|--union] [-p|--stdout] [-q|--quiet] [--marker-size=&lt;n&gt;]        [--[no-]diff3] &lt;current-file&gt; &lt;base-file&gt; &lt;other-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 merge-file</code>将从<code>&lt;base-file&gt;</code>to <code>&lt;other-file&gt;</code>导入的所有变化合并到一起<code>&lt;current-file&gt;</code>。结果通常会进入<code>&lt;current-file&gt;</code><code>git merge-file</code>对于将单独的更改组合到原始文件非常有用。假设<code>&lt;base-file&gt;</code>是原来的,都<code>&lt;current-file&gt;</code><code>&lt;other-file&gt;</code>都进行修改<code>&lt;base-file&gt;</code>,然后<code>git merge-file</code>结合了变化。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>如果两者都发生冲突<code>&lt;current-file&gt;</code>并且<code>&lt;other-file&gt;</code>在共同的线段中发生变化。如果发现冲突,<code>git merge-file</code>通常会输出一个警告,并将冲突与包含&lt;&lt;&lt;&lt;&lt;&lt;&lt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;标记的行进行括号。典型的冲突将如下所示:</p></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">&lt;&lt;&lt;&lt;&lt;&lt;&lt; A
lines in file A=======lines in file B&gt;&gt;&gt;&gt;&gt;&gt;&gt; B</pre></div></div><div class="doc-postil"><div class="c-markdown"><p>如果有冲突,用户应编辑结果并删除其中一个选项。然而,当<code>--ours</code><code>--theirs</code><code>--union</code>选项有效时,这些冲突分别有利于分别来自<code>&lt;current-file&gt;</code>线段<code>&lt;other-file&gt;</code>,来自线段或来自两者的线路。冲突标记的长度可以通过<code>--marker-size</code>选项给出。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>该程序的退出值对错误为负值否则冲突的数量如果存在多次冲突则截断为127。如果合并是干净的则退出值为0。</p></div></div><div class="doc-postil"><div class="c-markdown"><p><code>git merge-file</code>被设计成是 RCS <code>merge</code>也就是的最小克隆;这就说,它实现了 git 所需的所有 RCS <code>merge</code>功能[1]。</p></div></div><div class="doc-postil"><div class="c-markdown"><h2>选项</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>-L &lt;label&gt;</p></div></div><div class="doc-postil"><div class="c-markdown"><p>此选项最多可以放三次,并指定标签用于替代冲突报告中的相应文件名。也就是说,<code>git merge-file -L x -L y -L z a b c</code>生成的输出看起来好像来自文件xy 和 z而不是来自文件ab 和 c。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>-p</p></div></div><div class="doc-postil"><div class="c-markdown"><p>将结果发送到标准输出而不是覆盖<code>&lt;current-file&gt;</code></p></div></div><div class="doc-postil"><div class="c-markdown"><p>-q</p></div></div><div class="doc-postil"><div class="c-markdown"><p>安静; 不要警告冲突。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>--diff3</p></div></div><div class="doc-postil"><div class="c-markdown"><p>以“diff3”风格显示冲突。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>--ours   --theirs   --union</p></div></div><div class="doc-postil"><div class="c-markdown"><p>而不是在文件中留下冲突,解决有利于我们(或他们或两者)方面的冲突。</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 merge-file README.my README README.upstream</code></p></div></div><div class="doc-postil"><div class="c-markdown"><p>将自 README 后的 README.my
和 README.upstream 的更改结合起来,尝试合并它们并将结果写入
README.my。</p></div></div><div class="doc-postil"><div class="c-markdown"><p><code>git merge-file -L a -L b -L c tmp/a123 tmp/b234 tmp/c345</code></p></div></div><div class="doc-postil"><div class="c-markdown"><p>将tmp / a123 和 tmp / c345 与基本 tmp / b234合并但使用标签<code>a</code><code>c</code>而不是<code>tmp/a123</code><code>tmp/c345</code></p></div></div></div>