blob: eea56b3154ee8cb6c09a7dab8fd6ce44ace72822 [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--------
Martin von Zweigbergk7791a1d2011-07-01 22:38:26 -040011[verse]
Jean-Noël Avilaa443b762021-11-06 19:48:54 +010012'git merge-index' [-o] [-q] <merge-program> (-a | ( [--] <file>...) )
David Greaves2cf565c2005-05-10 22:32:30 +010013
14DESCRIPTION
15-----------
Lukas_Sandström5f3aa192005-11-11 02:12:27 +010016This looks up the <file>(s) in the index and, if there are any merge
Thomas Ackermannd5fa1f12013-04-15 19:49:04 +020017entries, passes the SHA-1 hash for those files as arguments 1, 2, 3 (empty
David Greaves2cf565c2005-05-10 22:32:30 +010018argument if no file), and <file> as argument 4. File modes for the three
19files are passed as arguments 5, 6 and 7.
20
21OPTIONS
22-------
seane9940042006-05-05 15:05:24 -040023\--::
Nikolai Weibull16cc50d2005-12-09 00:28:05 +010024 Do not interpret any more arguments as options.
David Greaves2cf565c2005-05-10 22:32:30 +010025
26-a::
Lukas_Sandström5f3aa192005-11-11 02:12:27 +010027 Run merge against all files in the index that need merging.
David Greaves2cf565c2005-05-10 22:32:30 +010028
Petr Baudis7ffeb8c2005-05-11 04:49:36 +020029-o::
30 Instead of stopping at the first failed merge, do all of them
31 in one shot - continue with merging even when previous merges
32 returned errors, and only return the error code after all the
Ralf Wildenhues29b802a2008-12-09 07:23:51 +010033 merges.
Petr Baudis7ffeb8c2005-05-11 04:49:36 +020034
Petr Baudisbbd14cb2005-07-29 14:53:38 +020035-q::
Ralf Wildenhues29b802a2008-12-09 07:23:51 +010036 Do not complain about a failed merge program (a merge program
37 failure usually indicates conflicts during the merge). This is for
Petr Baudisbbd14cb2005-07-29 14:53:38 +020038 porcelains which might want to emit custom messages.
39
Thomas Rast0b444cd2010-01-10 00:33:00 +010040If 'git merge-index' is called with multiple <file>s (or -a) then it
David Greaves2cf565c2005-05-10 22:32:30 +010041processes them in turn only stopping if merge returns a non-zero exit
42code.
43
Thomas Ackermann2de9b712013-01-21 20:17:53 +010044Typically this is run with a script calling Git's imitation of
Jonathan Nieder0979c102008-07-03 00:37:18 -050045the 'merge' command from the RCS package.
David Greaves2cf565c2005-05-10 22:32:30 +010046
Thomas Rast0b444cd2010-01-10 00:33:00 +010047A sample script called 'git merge-one-file' is included in the
Petr Baudisbbd14cb2005-07-29 14:53:38 +020048distribution.
David Greaves2cf565c2005-05-10 22:32:30 +010049
Thomas Ackermann2de9b712013-01-21 20:17:53 +010050ALERT ALERT ALERT! The Git "merge object order" is different from the
Jonathan Nieder2fd02c92008-07-03 00:55:07 -050051RCS 'merge' program merge object order. In the above ordering, the
David Greaves2cf565c2005-05-10 22:32:30 +010052original is first. But the argument order to the 3-way merge program
Jonathan Nieder2fd02c92008-07-03 00:55:07 -050053'merge' is to have the original in the middle. Don't ask me why.
David Greaves2cf565c2005-05-10 22:32:30 +010054
55Examples:
56
Martin Ågrenb7e1ba52019-09-07 16:12:52 +020057----
58torvalds@ppc970:~/merge-test> git merge-index cat MM
59This is MM from the original tree. # original
60This is modified MM in the branch A. # merge1
61This is modified MM in the branch B. # merge2
62This is modified MM in the branch B. # current contents
63----
David Greaves2cf565c2005-05-10 22:32:30 +010064
Junio C Hamanoa6080a02007-06-07 00:04:01 -070065or
David Greaves2cf565c2005-05-10 22:32:30 +010066
Martin Ågrenb7e1ba52019-09-07 16:12:52 +020067----
68torvalds@ppc970:~/merge-test> git merge-index cat AA MM
69cat: : No such file or directory
70This is added AA in the branch A.
71This is added AA in the branch B.
72This is added AA in the branch B.
73fatal: merge program failed
74----
David Greaves2cf565c2005-05-10 22:32:30 +010075
Thomas Rast0b444cd2010-01-10 00:33:00 +010076where the latter example shows how 'git merge-index' will stop trying to
Jonathan Nieder483bc4f2008-06-30 13:56:34 -050077merge once anything has returned an error (i.e., `cat` returned an error
David Greaves2cf565c2005-05-10 22:32:30 +010078for the AA file, because it didn't exist in the original, and thus
Thomas Rast0b444cd2010-01-10 00:33:00 +010079'git merge-index' didn't even try to merge the MM thing).
David Greaves2cf565c2005-05-10 22:32:30 +010080
David Greaves2cf565c2005-05-10 22:32:30 +010081GIT
82---
Christian Couder9e1f0a82008-06-06 09:07:32 +020083Part of the linkgit:git[1] suite