blob: 61f07ac35b30ca9f0dd96398c0a121d8dde18b45 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
<h1>git-merge-index</h1> <h2 id="_name">Name</h2> <div class="sectionbody"> <p>git-merge-index - Run a merge for files needing merging</p> </div> <h2 id="_synopsis">Synopsis</h2> <div class="sectionbody"> <div class="verseblock"> <pre class="content" data-language="shell">git merge-index [-o] [-q] <merge-program> (-a | ( [--] <file>…) )</pre> </div> </div> <h2 id="_description">Description</h2> <div class="sectionbody"> <p>This looks up the <file>(s) in the index and, if there are any merge entries, passes the SHA-1 hash for those files as arguments 1, 2, 3 (empty argument if no file), and <file> as argument 4. File modes for the three files are passed as arguments 5, 6 and 7.</p> </div> <h2 id="_options">Options</h2> <div class="sectionbody"> <div class="dlist"> <dl> <dt class="hdlist1" id="Documentation/git-merge-index.txt---"> -- </dt> <dd> <p>Do not interpret any more arguments as options.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge-index.txt--a"> -a </dt> <dd> <p>Run merge against all files in the index that need merging.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge-index.txt--o"> -o </dt> <dd> <p>Instead of stopping at the first failed merge, do all of them in one shot - continue with merging even when previous merges returned errors, and only return the error code after all the merges.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge-index.txt--q"> -q </dt> <dd> <p>Do not complain about a failed merge program (a merge program failure usually indicates conflicts during the merge). This is for porcelains which might want to emit custom messages.</p> </dd> </dl> </div> <p>If <code>git merge-index</code> is called with multiple <file>s (or -a) then it processes them in turn only stopping if merge returns a non-zero exit code.</p> <p>Typically this is run with a script calling Git’s imitation of the <code>merge</code> command from the RCS package.</p> <p>A sample script called <code>git merge-one-file</code> is included in the distribution.</p> <p>ALERT ALERT ALERT! The Git "merge object order" is different from the RCS <code>merge</code> program merge object order. In the above ordering, the original is first. But the argument order to the 3-way merge program <code>merge</code> is to have the original in the middle. Don’t ask me why.</p> <p>Examples:</p> <div class="listingblock"> <div class="content"> <pre>torvalds@ppc970:~/merge-test> git merge-index cat MM
This is MM from the original tree. # original
This is modified MM in the branch A. # merge1
This is modified MM in the branch B. # merge2
This is modified MM in the branch B. # current contents</pre> </div> </div> <p>or</p> <div class="listingblock"> <div class="content"> <pre>torvalds@ppc970:~/merge-test> git merge-index cat AA MM
cat: : No such file or directory
This is added AA in the branch A.
This is added AA in the branch B.
This is added AA in the branch B.
fatal: merge program failed</pre> </div> </div> <p>where the latter example shows how <code>git merge-index</code> will stop trying to merge once anything has returned an error (i.e., <code>cat</code> returned an error for the AA file, because it didn’t exist in the original, and thus <code>git merge-index</code> didn’t even try to merge the MM thing).</p> </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-merge-index" class="_attribution-link">https://git-scm.com/docs/git-merge-index</a>
</p>
</div>
|