blob: 4a5bb3900f6508f024c9484242537c8b8df90be6 [file] [log] [blame]
'\" t
.\" Title: git-merge-index
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 02/06/2019
.\" Manual: Git Manual
.\" Source: Git 2.21.0.rc0
.\" Language: English
.\"
.TH "GIT\-MERGE\-INDEX" "1" "02/06/2019" "Git 2\&.21\&.0\&.rc0" "Git Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
git-merge-index \- Run a merge for files needing merging
.SH "SYNOPSIS"
.sp
.nf
\fIgit merge\-index\fR [\-o] [\-q] <merge\-program> (\-a | [\-\-] <file>*)
.fi
.sp
.SH "DESCRIPTION"
.sp
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\&.
.SH "OPTIONS"
.PP
\-\-
.RS 4
Do not interpret any more arguments as options\&.
.RE
.PP
\-a
.RS 4
Run merge against all files in the index that need merging\&.
.RE
.PP
\-o
.RS 4
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\&.
.RE
.PP
\-q
.RS 4
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\&.
.RE
.sp
If \fIgit merge\-index\fR is called with multiple <file>s (or \-a) then it processes them in turn only stopping if merge returns a non\-zero exit code\&.
.sp
Typically this is run with a script calling Git\(cqs imitation of the \fImerge\fR command from the RCS package\&.
.sp
A sample script called \fIgit merge\-one\-file\fR is included in the distribution\&.
.sp
ALERT ALERT ALERT! The Git "merge object order" is different from the RCS \fImerge\fR program merge object order\&. In the above ordering, the original is first\&. But the argument order to the 3\-way merge program \fImerge\fR is to have the original in the middle\&. Don\(cqt ask me why\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
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
.fi
.if n \{\
.RE
.\}
.sp
or
.sp
.if n \{\
.RS 4
.\}
.nf
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
.fi
.if n \{\
.RE
.\}
.sp
where the latter example shows how \fIgit merge\-index\fR will stop trying to merge once anything has returned an error (i\&.e\&., \fBcat\fR returned an error for the AA file, because it didn\(cqt exist in the original, and thus \fIgit merge\-index\fR didn\(cqt even try to merge the MM thing)\&.
.SH "GIT"
.sp
Part of the \fBgit\fR(1) suite