| 1 | git-merge-index(1) |
| 2 | ================== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | git-merge-index - Run a merge for files needing merging |
| 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
| 11 | [verse] |
| 12 | 'git merge-index' [-o] [-q] <merge-program> (-a | ( [--] <file>...) ) |
| 13 | |
| 14 | DESCRIPTION |
| 15 | ----------- |
| 16 | This looks up the <file>(s) in the index and, if there are any merge |
| 17 | entries, passes the SHA-1 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 | ------- |
| 23 | \--:: |
| 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 |
| 33 | merges. |
| 34 | |
| 35 | -q:: |
| 36 | Do not complain about a failed merge program (a merge program |
| 37 | failure usually indicates conflicts during the merge). This is for |
| 38 | porcelains which might want to emit custom messages. |
| 39 | |
| 40 | If 'git merge-index' is called with multiple <file>s (or -a) then it |
| 41 | processes them in turn only stopping if merge returns a non-zero exit |
| 42 | code. |
| 43 | |
| 44 | Typically this is run with a script calling Git's imitation of |
| 45 | the 'merge' command from the RCS package. |
| 46 | |
| 47 | A sample script called 'git merge-one-file' is included in the |
| 48 | distribution. |
| 49 | |
| 50 | ALERT ALERT ALERT! The Git "merge object order" is different from the |
| 51 | RCS 'merge' program merge object order. In the above ordering, the |
| 52 | original is first. But the argument order to the 3-way merge program |
| 53 | 'merge' is to have the original in the middle. Don't ask me why. |
| 54 | |
| 55 | Examples: |
| 56 | |
| 57 | ---- |
| 58 | torvalds@ppc970:~/merge-test> git merge-index cat MM |
| 59 | This is MM from the original tree. # original |
| 60 | This is modified MM in the branch A. # merge1 |
| 61 | This is modified MM in the branch B. # merge2 |
| 62 | This is modified MM in the branch B. # current contents |
| 63 | ---- |
| 64 | |
| 65 | or |
| 66 | |
| 67 | ---- |
| 68 | torvalds@ppc970:~/merge-test> git merge-index cat AA MM |
| 69 | cat: : No such file or directory |
| 70 | This is added AA in the branch A. |
| 71 | This is added AA in the branch B. |
| 72 | This is added AA in the branch B. |
| 73 | fatal: merge program failed |
| 74 | ---- |
| 75 | |
| 76 | where the latter example shows how 'git merge-index' will stop trying to |
| 77 | merge once anything has returned an error (i.e., `cat` returned an error |
| 78 | for the AA file, because it didn't exist in the original, and thus |
| 79 | 'git merge-index' didn't even try to merge the MM thing). |
| 80 | |
| 81 | GIT |
| 82 | --- |
| 83 | Part of the linkgit:git[1] suite |