blob: e0df1b33408df881057963896fb0d0d3cd5edd66 [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git-merge-index(1)
2==================
3
4NAME
5----
Junio C Hamano7c73c662007-01-19 00:37:506git-merge-index - Run a merge for files needing merging
Junio C Hamano1a4e8412005-12-27 08:17:237
8
9SYNOPSIS
10--------
Junio C Hamano15567bc2011-07-23 00:51:5911[verse]
Junio C Hamano2db3e752010-09-03 21:33:0612'git merge-index' [-o] [-q] <merge-program> (-a | [--] <file>*)
Junio C Hamano1a4e8412005-12-27 08:17:2313
14DESCRIPTION
15-----------
16This looks up the <file>(s) in the index and, if there are any merge
17entries, passes the SHA1 hash for those files as arguments 1, 2, 3 (empty
18argument 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-------
Junio C Hamano1bb569e2006-05-05 23:14:2523\--::
Junio C Hamano1a4e8412005-12-27 08:17:2324Do not interpret any more arguments as options.
25
26-a::
27Run merge against all files in the index that need merging.
28
29-o::
30Instead of stopping at the first failed merge, do all of them
31in one shot - continue with merging even when previous merges
32returned errors, and only return the error code after all the
Junio C Hamanoec87f522008-12-10 08:35:2533merges.
Junio C Hamano1a4e8412005-12-27 08:17:2334
35-q::
Junio C Hamanoec87f522008-12-10 08:35:2536Do not complain about a failed merge program (a merge program
37failure usually indicates conflicts during the merge). This is for
Junio C Hamano1a4e8412005-12-27 08:17:2338porcelains which might want to emit custom messages.
39
Junio C Hamano1aa40d22010-01-21 17:46:4340If 'git merge-index' is called with multiple <file>s (or -a) then it
Junio C Hamano1a4e8412005-12-27 08:17:2341processes them in turn only stopping if merge returns a non-zero exit
42code.
43
Junio C Hamano764a6672007-10-23 01:23:3144Typically this is run with a script calling git's imitation of
Junio C Hamanoba4b9282008-07-06 05:20:3145the 'merge' command from the RCS package.
Junio C Hamano1a4e8412005-12-27 08:17:2346
Junio C Hamano1aa40d22010-01-21 17:46:4347A sample script called 'git merge-one-file' is included in the
Junio C Hamano1a4e8412005-12-27 08:17:2348distribution.
49
50ALERT ALERT ALERT! The git "merge object order" is different from the
Junio C Hamanoba4b9282008-07-06 05:20:3151RCS 'merge' program merge object order. In the above ordering, the
Junio C Hamano1a4e8412005-12-27 08:17:2352original is first. But the argument order to the 3-way merge program
Junio C Hamanoba4b9282008-07-06 05:20:3153'merge' is to have the original in the middle. Don't ask me why.
Junio C Hamano1a4e8412005-12-27 08:17:2354
55Examples:
56
Junio C Hamanofce7c7e2008-07-02 03:06:3857 torvalds@ppc970:~/merge-test> git merge-index cat MM
Junio C Hamano1a4e8412005-12-27 08:17:2358 This is MM from the original tree. # original
59 This is modified MM in the branch A. # merge1
60 This is modified MM in the branch B. # merge2
61 This is modified MM in the branch B. # current contents
62
Junio C Hamanoa77a5132007-06-08 16:13:4463or
Junio C Hamano1a4e8412005-12-27 08:17:2364
Junio C Hamanofce7c7e2008-07-02 03:06:3865 torvalds@ppc970:~/merge-test> git merge-index cat AA MM
Junio C Hamano1a4e8412005-12-27 08:17:2366 cat: : No such file or directory
67 This is added AA in the branch A.
68 This is added AA in the branch B.
69 This is added AA in the branch B.
70 fatal: merge program failed
71
Junio C Hamano1aa40d22010-01-21 17:46:4372where the latter example shows how 'git merge-index' will stop trying to
Junio C Hamanofce7c7e2008-07-02 03:06:3873merge once anything has returned an error (i.e., `cat` returned an error
Junio C Hamano1a4e8412005-12-27 08:17:2374for the AA file, because it didn't exist in the original, and thus
Junio C Hamano1aa40d22010-01-21 17:46:4375'git merge-index' didn't even try to merge the MM thing).
Junio C Hamano1a4e8412005-12-27 08:17:2376
Junio C Hamano1a4e8412005-12-27 08:17:2377GIT
78---
Junio C Hamanof7c042d2008-06-06 22:50:5379Part of the linkgit:git[1] suite