man-pages/man1/git-merge-index.1.html
2021-03-31 01:06:50 +01:00

154 lines
3.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of GIT-MERGE-INDEX</TITLE>
</HEAD><BODY>
<H1>GIT-MERGE-INDEX</H1>
Section: Git Manual (1)<BR>Updated: 03/04/2021<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
git-merge-index - Run a merge for files needing merging
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<P>
<PRE>
<I>git merge-index</I> [-o] [-q] &lt;merge-program&gt; (-a | [--] &lt;file&gt;*)
</PRE>
<P>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<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.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<P>
--
<DL COMPACT><DT id="1"><DD>
Do not interpret any more arguments as options.
</DL>
<P>
-a
<DL COMPACT><DT id="2"><DD>
Run merge against all files in the index that need merging.
</DL>
<P>
-o
<DL COMPACT><DT id="3"><DD>
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.
</DL>
<P>
-q
<DL COMPACT><DT id="4"><DD>
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.
</DL>
<P>
If <I>git merge-index</I> 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>
Typically this is run with a script calling Git's imitation of the <I>merge</I> command from the RCS package.
<P>
A sample script called <I>git merge-one-file</I> is included in the distribution.
<P>
ALERT ALERT ALERT! The Git &quot;merge object order&quot; is different from the RCS <I>merge</I> program merge object order. In the above ordering, the original is first. But the argument order to the 3-way merge program <I>merge</I> is to have the original in the middle. Don't ask me why.
<P>
Examples:
<P>
<DL COMPACT><DT id="5"><DD>
<PRE>
<A HREF="mailto:torvalds@ppc970">torvalds@ppc970</A>:~/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>
</DL>
<P>
<P>
or
<P>
<DL COMPACT><DT id="6"><DD>
<PRE>
<A HREF="mailto:torvalds@ppc970">torvalds@ppc970</A>:~/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>
</DL>
<P>
<P>
where the latter example shows how <I>git merge-index</I> will stop trying to merge once anything has returned an error (i.e., <B>cat</B> returned an error for the AA file, because it didn't exist in the original, and thus <I>git merge-index</I> didn't even try to merge the MM thing).
<A NAME="lbAF">&nbsp;</A>
<H2>GIT</H2>
<P>
Part of the <B><A HREF="/cgi-bin/man/man2html?1+git">git</A></B>(1) suite
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="7"><A HREF="#lbAB">NAME</A><DD>
<DT id="8"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="9"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="10"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="11"><A HREF="#lbAF">GIT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:14 GMT, March 31, 2021
</BODY>
</HTML>