summaryrefslogtreecommitdiff
path: root/devdocs/git/git-merge-index.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/git/git-merge-index.html
new repository
Diffstat (limited to 'devdocs/git/git-merge-index.html')
-rw-r--r--devdocs/git/git-merge-index.html15
1 files changed, 15 insertions, 0 deletions
diff --git a/devdocs/git/git-merge-index.html b/devdocs/git/git-merge-index.html
new file mode 100644
index 00000000..61f07ac3
--- /dev/null
+++ b/devdocs/git/git-merge-index.html
@@ -0,0 +1,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] &lt;merge-program&gt; (-a | ( [--] &lt;file&gt;…​) )</pre> </div> </div> <h2 id="_description">Description</h2> <div class="sectionbody"> <p>This looks up the &lt;file&gt;(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 &lt;file&gt; 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 &lt;file&gt;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&gt; 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&gt; 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">
+ &copy; 2012&ndash;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>