blob: 123e6d024a47537981526d0c078249565e72d74f [file] [log] [blame]
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001git-merge-index(1)
David Greaves2cf565c2005-05-10 22:32:30 +01002==================
David Greaves2cf565c2005-05-10 22:32:30 +01003
4NAME
5----
Junio C Hamanoc3f0baa2007-01-18 15:53:37 -08006git-merge-index - Run a merge for files needing merging
David Greaves2cf565c2005-05-10 22:32:30 +01007
8
9SYNOPSIS
10--------
Jonathan Niederb1889c32008-06-30 01:09:04 -050011'git merge-index' [-o] [-q] <merge-program> (-a | [--] <file>\*)
David Greaves2cf565c2005-05-10 22:32:30 +010012
13DESCRIPTION
14-----------
Lukas_Sandström5f3aa192005-11-11 02:12:27 +010015This looks up the <file>(s) in the index and, if there are any merge
David Greaves2cf565c2005-05-10 22:32:30 +010016entries, passes the SHA1 hash for those files as arguments 1, 2, 3 (empty
17argument if no file), and <file> as argument 4. File modes for the three
18files are passed as arguments 5, 6 and 7.
19
20OPTIONS
21-------
seane9940042006-05-05 15:05:24 -040022\--::
Nikolai Weibull16cc50d2005-12-09 00:28:05 +010023 Do not interpret any more arguments as options.
David Greaves2cf565c2005-05-10 22:32:30 +010024
25-a::
Lukas_Sandström5f3aa192005-11-11 02:12:27 +010026 Run merge against all files in the index that need merging.
David Greaves2cf565c2005-05-10 22:32:30 +010027
Petr Baudis7ffeb8c2005-05-11 04:49:36 +020028-o::
29 Instead of stopping at the first failed merge, do all of them
30 in one shot - continue with merging even when previous merges
31 returned errors, and only return the error code after all the
Ralf Wildenhues29b802a2008-12-09 07:23:51 +010032 merges.
Petr Baudis7ffeb8c2005-05-11 04:49:36 +020033
Petr Baudisbbd14cb2005-07-29 14:53:38 +020034-q::
Ralf Wildenhues29b802a2008-12-09 07:23:51 +010035 Do not complain about a failed merge program (a merge program
36 failure usually indicates conflicts during the merge). This is for
Petr Baudisbbd14cb2005-07-29 14:53:38 +020037 porcelains which might want to emit custom messages.
38
Jonathan Niederba020ef2008-07-03 00:41:41 -050039If 'git-merge-index' is called with multiple <file>s (or -a) then it
David Greaves2cf565c2005-05-10 22:32:30 +010040processes them in turn only stopping if merge returns a non-zero exit
41code.
42
Ralf Wildenhues06ada152007-10-09 23:00:03 +020043Typically this is run with a script calling git's imitation of
Jonathan Nieder0979c102008-07-03 00:37:18 -050044the 'merge' command from the RCS package.
David Greaves2cf565c2005-05-10 22:32:30 +010045
Jonathan Niederba020ef2008-07-03 00:41:41 -050046A sample script called 'git-merge-one-file' is included in the
Petr Baudisbbd14cb2005-07-29 14:53:38 +020047distribution.
David Greaves2cf565c2005-05-10 22:32:30 +010048
49ALERT ALERT ALERT! The git "merge object order" is different from the
Jonathan Nieder2fd02c92008-07-03 00:55:07 -050050RCS 'merge' program merge object order. In the above ordering, the
David Greaves2cf565c2005-05-10 22:32:30 +010051original is first. But the argument order to the 3-way merge program
Jonathan Nieder2fd02c92008-07-03 00:55:07 -050052'merge' is to have the original in the middle. Don't ask me why.
David Greaves2cf565c2005-05-10 22:32:30 +010053
54Examples:
55
Jonathan Niederb1889c32008-06-30 01:09:04 -050056 torvalds@ppc970:~/merge-test> git merge-index cat MM
David Greaves2cf565c2005-05-10 22:32:30 +010057 This is MM from the original tree. # original
58 This is modified MM in the branch A. # merge1
59 This is modified MM in the branch B. # merge2
60 This is modified MM in the branch B. # current contents
61
Junio C Hamanoa6080a02007-06-07 00:04:01 -070062or
David Greaves2cf565c2005-05-10 22:32:30 +010063
Jonathan Niederb1889c32008-06-30 01:09:04 -050064 torvalds@ppc970:~/merge-test> git merge-index cat AA MM
David Greaves2cf565c2005-05-10 22:32:30 +010065 cat: : No such file or directory
66 This is added AA in the branch A.
67 This is added AA in the branch B.
68 This is added AA in the branch B.
69 fatal: merge program failed
70
Jonathan Niederba020ef2008-07-03 00:41:41 -050071where the latter example shows how 'git-merge-index' will stop trying to
Jonathan Nieder483bc4f2008-06-30 13:56:34 -050072merge once anything has returned an error (i.e., `cat` returned an error
David Greaves2cf565c2005-05-10 22:32:30 +010073for the AA file, because it didn't exist in the original, and thus
Jonathan Niederba020ef2008-07-03 00:41:41 -050074'git-merge-index' didn't even try to merge the MM thing).
David Greaves2cf565c2005-05-10 22:32:30 +010075
76Author
77------
78Written by Linus Torvalds <torvalds@osdl.org>
Petr Baudis7ffeb8c2005-05-11 04:49:36 +020079One-shot merge by Petr Baudis <pasky@ucw.cz>
David Greaves2cf565c2005-05-10 22:32:30 +010080
81Documentation
82--------------
83Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
84
85GIT
86---
Christian Couder9e1f0a82008-06-06 09:07:32 +020087Part of the linkgit:git[1] suite