Junio C Hamano | 215a7ad | 2005-09-07 17:26:23 -0700 | [diff] [blame] | 1 | git-merge-index(1) |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 2 | ================== |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | c3f0baa | 2007-01-18 15:53:37 -0800 | [diff] [blame] | 6 | git-merge-index - Run a merge for files needing merging |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
Jonathan Nieder | b1889c3 | 2008-06-30 01:09:04 -0500 | [diff] [blame] | 11 | 'git merge-index' [-o] [-q] <merge-program> (-a | [--] <file>\*) |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 12 | |
| 13 | DESCRIPTION |
| 14 | ----------- |
Lukas_Sandström | 5f3aa19 | 2005-11-11 02:12:27 +0100 | [diff] [blame] | 15 | This looks up the <file>(s) in the index and, if there are any merge |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 16 | entries, passes the SHA1 hash for those files as arguments 1, 2, 3 (empty |
| 17 | argument if no file), and <file> as argument 4. File modes for the three |
| 18 | files are passed as arguments 5, 6 and 7. |
| 19 | |
| 20 | OPTIONS |
| 21 | ------- |
sean | e994004 | 2006-05-05 15:05:24 -0400 | [diff] [blame] | 22 | \--:: |
Nikolai Weibull | 16cc50d | 2005-12-09 00:28:05 +0100 | [diff] [blame] | 23 | Do not interpret any more arguments as options. |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 24 | |
| 25 | -a:: |
Lukas_Sandström | 5f3aa19 | 2005-11-11 02:12:27 +0100 | [diff] [blame] | 26 | Run merge against all files in the index that need merging. |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 27 | |
Petr Baudis | 7ffeb8c | 2005-05-11 04:49:36 +0200 | [diff] [blame] | 28 | -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 Wildenhues | 29b802a | 2008-12-09 07:23:51 +0100 | [diff] [blame] | 32 | merges. |
Petr Baudis | 7ffeb8c | 2005-05-11 04:49:36 +0200 | [diff] [blame] | 33 | |
Petr Baudis | bbd14cb | 2005-07-29 14:53:38 +0200 | [diff] [blame] | 34 | -q:: |
Ralf Wildenhues | 29b802a | 2008-12-09 07:23:51 +0100 | [diff] [blame] | 35 | Do not complain about a failed merge program (a merge program |
| 36 | failure usually indicates conflicts during the merge). This is for |
Petr Baudis | bbd14cb | 2005-07-29 14:53:38 +0200 | [diff] [blame] | 37 | porcelains which might want to emit custom messages. |
| 38 | |
Jonathan Nieder | ba020ef | 2008-07-03 00:41:41 -0500 | [diff] [blame] | 39 | If 'git-merge-index' is called with multiple <file>s (or -a) then it |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 40 | processes them in turn only stopping if merge returns a non-zero exit |
| 41 | code. |
| 42 | |
Ralf Wildenhues | 06ada15 | 2007-10-09 23:00:03 +0200 | [diff] [blame] | 43 | Typically this is run with a script calling git's imitation of |
Jonathan Nieder | 0979c10 | 2008-07-03 00:37:18 -0500 | [diff] [blame] | 44 | the 'merge' command from the RCS package. |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 45 | |
Jonathan Nieder | ba020ef | 2008-07-03 00:41:41 -0500 | [diff] [blame] | 46 | A sample script called 'git-merge-one-file' is included in the |
Petr Baudis | bbd14cb | 2005-07-29 14:53:38 +0200 | [diff] [blame] | 47 | distribution. |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 48 | |
| 49 | ALERT ALERT ALERT! The git "merge object order" is different from the |
Jonathan Nieder | 2fd02c9 | 2008-07-03 00:55:07 -0500 | [diff] [blame] | 50 | RCS 'merge' program merge object order. In the above ordering, the |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 51 | original is first. But the argument order to the 3-way merge program |
Jonathan Nieder | 2fd02c9 | 2008-07-03 00:55:07 -0500 | [diff] [blame] | 52 | 'merge' is to have the original in the middle. Don't ask me why. |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 53 | |
| 54 | Examples: |
| 55 | |
Jonathan Nieder | b1889c3 | 2008-06-30 01:09:04 -0500 | [diff] [blame] | 56 | torvalds@ppc970:~/merge-test> git merge-index cat MM |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 57 | 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 Hamano | a6080a0 | 2007-06-07 00:04:01 -0700 | [diff] [blame] | 62 | or |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 63 | |
Jonathan Nieder | b1889c3 | 2008-06-30 01:09:04 -0500 | [diff] [blame] | 64 | torvalds@ppc970:~/merge-test> git merge-index cat AA MM |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 65 | 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 Nieder | ba020ef | 2008-07-03 00:41:41 -0500 | [diff] [blame] | 71 | where the latter example shows how 'git-merge-index' will stop trying to |
Jonathan Nieder | 483bc4f | 2008-06-30 13:56:34 -0500 | [diff] [blame] | 72 | merge once anything has returned an error (i.e., `cat` returned an error |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 73 | for the AA file, because it didn't exist in the original, and thus |
Jonathan Nieder | ba020ef | 2008-07-03 00:41:41 -0500 | [diff] [blame] | 74 | 'git-merge-index' didn't even try to merge the MM thing). |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 75 | |
| 76 | Author |
| 77 | ------ |
| 78 | Written by Linus Torvalds <torvalds@osdl.org> |
Petr Baudis | 7ffeb8c | 2005-05-11 04:49:36 +0200 | [diff] [blame] | 79 | One-shot merge by Petr Baudis <pasky@ucw.cz> |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 80 | |
| 81 | Documentation |
| 82 | -------------- |
| 83 | Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>. |
| 84 | |
| 85 | GIT |
| 86 | --- |
Christian Couder | 9e1f0a8 | 2008-06-06 09:07:32 +0200 | [diff] [blame] | 87 | Part of the linkgit:git[1] suite |