Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-merge-index(1) |
| 2 | ================== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 6 | git-merge-index - Run a merge for files needing merging |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
Junio C Hamano | 15567bc | 2011-07-23 00:51:59 | [diff] [blame] | 11 | [verse] |
Junio C Hamano | 2db3e75 | 2010-09-03 21:33:06 | [diff] [blame] | 12 | 'git merge-index' [-o] [-q] <merge-program> (-a | [--] <file>*) |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 13 | |
| 14 | DESCRIPTION |
| 15 | ----------- |
| 16 | This looks up the <file>(s) in the index and, if there are any merge |
| 17 | entries, passes the SHA1 hash for those files as arguments 1, 2, 3 (empty |
| 18 | argument if no file), and <file> as argument 4. File modes for the three |
| 19 | files are passed as arguments 5, 6 and 7. |
| 20 | |
| 21 | OPTIONS |
| 22 | ------- |
Junio C Hamano | 1bb569e | 2006-05-05 23:14:25 | [diff] [blame] | 23 | \--:: |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 24 | Do not interpret any more arguments as options. |
| 25 | |
| 26 | -a:: |
| 27 | Run merge against all files in the index that need merging. |
| 28 | |
| 29 | -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 |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 33 | merges. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 34 | |
| 35 | -q:: |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 36 | Do not complain about a failed merge program (a merge program |
| 37 | failure usually indicates conflicts during the merge). This is for |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 38 | porcelains which might want to emit custom messages. |
| 39 | |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 40 | If 'git merge-index' is called with multiple <file>s (or -a) then it |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 41 | processes them in turn only stopping if merge returns a non-zero exit |
| 42 | code. |
| 43 | |
Junio C Hamano | 764a667 | 2007-10-23 01:23:31 | [diff] [blame] | 44 | Typically this is run with a script calling git's imitation of |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 45 | the 'merge' command from the RCS package. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 46 | |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 47 | A sample script called 'git merge-one-file' is included in the |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 48 | distribution. |
| 49 | |
| 50 | ALERT ALERT ALERT! The git "merge object order" is different from the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 51 | RCS 'merge' program merge object order. In the above ordering, the |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 52 | original is first. But the argument order to the 3-way merge program |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 53 | 'merge' is to have the original in the middle. Don't ask me why. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 54 | |
| 55 | Examples: |
| 56 | |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 57 | torvalds@ppc970:~/merge-test> git merge-index cat MM |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 58 | 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 Hamano | a77a513 | 2007-06-08 16:13:44 | [diff] [blame] | 63 | or |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 64 | |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 65 | torvalds@ppc970:~/merge-test> git merge-index cat AA MM |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 66 | 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 Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 72 | where the latter example shows how 'git merge-index' will stop trying to |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 73 | merge once anything has returned an error (i.e., `cat` returned an error |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 74 | for the AA file, because it didn't exist in the original, and thus |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 75 | 'git merge-index' didn't even try to merge the MM thing). |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 76 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 77 | GIT |
| 78 | --- |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 79 | Part of the linkgit:git[1] suite |