blob: 123e6d024a47537981526d0c078249565e72d74f [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 Hamanofce7c7e2008-07-02 03:06:3811'git merge-index' [-o] [-q] <merge-program> (-a | [--] <file>\*)
Junio C Hamano1a4e8412005-12-27 08:17:2312
13DESCRIPTION
14-----------
15This looks up the <file>(s) in the index and, if there are any merge
16entries, 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-------
Junio C Hamano1bb569e2006-05-05 23:14:2522\--::
Junio C Hamano1a4e8412005-12-27 08:17:2323Do not interpret any more arguments as options.
24
25-a::
26Run merge against all files in the index that need merging.
27
28-o::
29Instead of stopping at the first failed merge, do all of them
30in one shot - continue with merging even when previous merges
31returned errors, and only return the error code after all the
Junio C Hamanoec87f522008-12-10 08:35:2532merges.
Junio C Hamano1a4e8412005-12-27 08:17:2333
34-q::
Junio C Hamanoec87f522008-12-10 08:35:2535Do not complain about a failed merge program (a merge program
36failure usually indicates conflicts during the merge). This is for
Junio C Hamano1a4e8412005-12-27 08:17:2337porcelains which might want to emit custom messages.
38
Junio C Hamanoba4b9282008-07-06 05:20:3139If 'git-merge-index' is called with multiple <file>s (or -a) then it
Junio C Hamano1a4e8412005-12-27 08:17:2340processes them in turn only stopping if merge returns a non-zero exit
41code.
42
Junio C Hamano764a6672007-10-23 01:23:3143Typically this is run with a script calling git's imitation of
Junio C Hamanoba4b9282008-07-06 05:20:3144the 'merge' command from the RCS package.
Junio C Hamano1a4e8412005-12-27 08:17:2345
Junio C Hamanoba4b9282008-07-06 05:20:3146A sample script called 'git-merge-one-file' is included in the
Junio C Hamano1a4e8412005-12-27 08:17:2347distribution.
48
49ALERT ALERT ALERT! The git "merge object order" is different from the
Junio C Hamanoba4b9282008-07-06 05:20:3150RCS 'merge' program merge object order. In the above ordering, the
Junio C Hamano1a4e8412005-12-27 08:17:2351original is first. But the argument order to the 3-way merge program
Junio C Hamanoba4b9282008-07-06 05:20:3152'merge' is to have the original in the middle. Don't ask me why.
Junio C Hamano1a4e8412005-12-27 08:17:2353
54Examples:
55
Junio C Hamanofce7c7e2008-07-02 03:06:3856 torvalds@ppc970:~/merge-test> git merge-index cat MM
Junio C Hamano1a4e8412005-12-27 08:17:2357 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 Hamanoa77a5132007-06-08 16:13:4462or
Junio C Hamano1a4e8412005-12-27 08:17:2363
Junio C Hamanofce7c7e2008-07-02 03:06:3864 torvalds@ppc970:~/merge-test> git merge-index cat AA MM
Junio C Hamano1a4e8412005-12-27 08:17:2365 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
Junio C Hamanoba4b9282008-07-06 05:20:3171where the latter example shows how 'git-merge-index' will stop trying to
Junio C Hamanofce7c7e2008-07-02 03:06:3872merge once anything has returned an error (i.e., `cat` returned an error
Junio C Hamano1a4e8412005-12-27 08:17:2373for the AA file, because it didn't exist in the original, and thus
Junio C Hamanoba4b9282008-07-06 05:20:3174'git-merge-index' didn't even try to merge the MM thing).
Junio C Hamano1a4e8412005-12-27 08:17:2375
76Author
77------
78Written by Linus Torvalds <torvalds@osdl.org>
79One-shot merge by Petr Baudis <pasky@ucw.cz>
80
81Documentation
82--------------
83Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
84
85GIT
86---
Junio C Hamanof7c042d2008-06-06 22:50:5387Part of the linkgit:git[1] suite