Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 1 | git-merge-file(1) |
| 2 | ================= |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 6 | git-merge-file - Run a three-way file merge |
Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
| 11 | [verse] |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 12 | 'git merge-file' [-L <current-name> [-L <base-name> [-L <other-name>]]] |
Junio C Hamano | 0299d92 | 2010-03-20 20:59:31 | [diff] [blame] | 13 | [--ours|--theirs|--union] [-p|--stdout] [-q|--quiet] [--marker-size=<n>] |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 14 | <current-file> <base-file> <other-file> |
Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 15 | |
| 16 | |
| 17 | DESCRIPTION |
| 18 | ----------- |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 19 | 'git merge-file' incorporates all changes that lead from the `<base-file>` |
Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 20 | to `<other-file>` into `<current-file>`. The result ordinarily goes into |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 21 | `<current-file>`. 'git merge-file' is useful for combining separate changes |
Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 22 | to an original. Suppose `<base-file>` is the original, and both |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 23 | `<current-file>` and `<other-file>` are modifications of `<base-file>`, |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 24 | then 'git merge-file' combines both changes. |
Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 25 | |
| 26 | A conflict occurs if both `<current-file>` and `<other-file>` have changes |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 27 | in a common segment of lines. If a conflict is found, 'git merge-file' |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 28 | normally outputs a warning and brackets the conflict with lines containing |
| 29 | <<<<<<< and >>>>>>> markers. A typical conflict will look like this: |
Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 30 | |
| 31 | <<<<<<< A |
| 32 | lines in file A |
| 33 | ======= |
| 34 | lines in file B |
| 35 | >>>>>>> B |
| 36 | |
| 37 | If there are conflicts, the user should edit the result and delete one of |
Junio C Hamano | 0299d92 | 2010-03-20 20:59:31 | [diff] [blame] | 38 | the alternatives. When `--ours`, `--theirs`, or `--union` option is in effect, |
| 39 | however, these conflicts are resolved favouring lines from `<current-file>`, |
| 40 | lines from `<other-file>`, or lines from both respectively. The length of the |
| 41 | conflict markers can be given with the `--marker-size` option. |
Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 42 | |
| 43 | The exit value of this program is negative on error, and the number of |
| 44 | conflicts otherwise. If the merge was clean, the exit value is 0. |
| 45 | |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 46 | 'git merge-file' is designed to be a minimal clone of RCS 'merge'; that is, it |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 47 | implements all of RCS 'merge''s functionality which is needed by |
Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 48 | linkgit:git[1]. |
Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 49 | |
| 50 | |
| 51 | OPTIONS |
| 52 | ------- |
| 53 | |
| 54 | -L <label>:: |
| 55 | This option may be given up to three times, and |
| 56 | specifies labels to be used in place of the |
| 57 | corresponding file names in conflict reports. That is, |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 58 | `git merge-file -L x -L y -L z a b c` generates output that |
Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 59 | looks like it came from files x, y and z instead of |
| 60 | from files a, b and c. |
| 61 | |
| 62 | -p:: |
| 63 | Send results to standard output instead of overwriting |
| 64 | `<current-file>`. |
| 65 | |
| 66 | -q:: |
Junio C Hamano | ec87f52 | 2008-12-10 08:35:25 | [diff] [blame] | 67 | Quiet; do not warn about conflicts. |
Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 68 | |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 69 | --ours:: |
| 70 | --theirs:: |
Junio C Hamano | 0299d92 | 2010-03-20 20:59:31 | [diff] [blame] | 71 | --union:: |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 72 | Instead of leaving conflicts in the file, resolve conflicts |
Junio C Hamano | 0299d92 | 2010-03-20 20:59:31 | [diff] [blame] | 73 | favouring our (or their or both) side of the lines. |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 74 | |
Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 75 | |
| 76 | EXAMPLES |
| 77 | -------- |
| 78 | |
Junio C Hamano | 16ebcd0 | 2011-08-05 00:05:45 | [diff] [blame^] | 79 | `git merge-file README.my README README.upstream`:: |
Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 80 | |
| 81 | combines the changes of README.my and README.upstream since README, |
| 82 | tries to merge them and writes the result into README.my. |
| 83 | |
Junio C Hamano | 16ebcd0 | 2011-08-05 00:05:45 | [diff] [blame^] | 84 | `git merge-file -L a -L b -L c tmp/a123 tmp/b234 tmp/c345`:: |
Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 85 | |
| 86 | merges tmp/a123 and tmp/c345 with the base tmp/b234, but uses labels |
| 87 | `a` and `c` instead of `tmp/a123` and `tmp/c345`. |
| 88 | |
Junio C Hamano | 1de7bc6 | 2006-12-17 19:31:54 | [diff] [blame] | 89 | GIT |
| 90 | --- |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 91 | Part of the linkgit:git[1] suite |