blob: f85603261325f6f88b31c30b5fb2bafcded58d92 [file] [log] [blame]
Junio C Hamano1de7bc62006-12-17 19:31:541git-merge-file(1)
2=================
3
4NAME
5----
Junio C Hamano7c73c662007-01-19 00:37:506git-merge-file - Run a three-way file merge
Junio C Hamano1de7bc62006-12-17 19:31:547
8
9SYNOPSIS
10--------
11[verse]
Junio C Hamanofce7c7e2008-07-02 03:06:3812'git merge-file' [-L <current-name> [-L <base-name> [-L <other-name>]]]
Junio C Hamano0299d922010-03-20 20:59:3113[--ours|--theirs|--union] [-p|--stdout] [-q|--quiet] [--marker-size=<n>]
Junio C Hamano0241d052013-08-30 23:52:1714[--[no-]diff3] <current-file> <base-file> <other-file>
Junio C Hamano1de7bc62006-12-17 19:31:5415
16
17DESCRIPTION
18-----------
Junio C Hamano1aa40d22010-01-21 17:46:4319'git merge-file' incorporates all changes that lead from the `<base-file>`
Junio C Hamano1de7bc62006-12-17 19:31:5420to `<other-file>` into `<current-file>`. The result ordinarily goes into
Junio C Hamano1aa40d22010-01-21 17:46:4321`<current-file>`. 'git merge-file' is useful for combining separate changes
Junio C Hamano1de7bc62006-12-17 19:31:5422to an original. Suppose `<base-file>` is the original, and both
Junio C Hamanoec87f522008-12-10 08:35:2523`<current-file>` and `<other-file>` are modifications of `<base-file>`,
Junio C Hamano1aa40d22010-01-21 17:46:4324then 'git merge-file' combines both changes.
Junio C Hamano1de7bc62006-12-17 19:31:5425
26A conflict occurs if both `<current-file>` and `<other-file>` have changes
Junio C Hamano1aa40d22010-01-21 17:46:4327in a common segment of lines. If a conflict is found, 'git merge-file'
Junio C Hamanoec87f522008-12-10 08:35:2528normally outputs a warning and brackets the conflict with lines containing
29<<<<<<< and >>>>>>> markers. A typical conflict will look like this:
Junio C Hamano1de7bc62006-12-17 19:31:5430
31<<<<<<< A
32lines in file A
33=======
34lines in file B
35>>>>>>> B
36
37If there are conflicts, the user should edit the result and delete one of
Junio C Hamano0299d922010-03-20 20:59:3138the alternatives. When `--ours`, `--theirs`, or `--union` option is in effect,
39however, these conflicts are resolved favouring lines from `<current-file>`,
40lines from `<other-file>`, or lines from both respectively. The length of the
41conflict markers can be given with the `--marker-size` option.
Junio C Hamano1de7bc62006-12-17 19:31:5442
43The exit value of this program is negative on error, and the number of
Junio C Hamano448d1322015-10-30 21:57:5444conflicts otherwise (truncated to 127 if there are more than that many
45conflicts). If the merge was clean, the exit value is 0.
Junio C Hamano1de7bc62006-12-17 19:31:5446
Junio C Hamano1aa40d22010-01-21 17:46:4347'git merge-file' is designed to be a minimal clone of RCS 'merge'; that is, it
Junio C Hamanoba4b9282008-07-06 05:20:3148implements all of RCS 'merge''s functionality which is needed by
Junio C Hamano35738e82008-01-07 07:55:4649linkgit:git[1].
Junio C Hamano1de7bc62006-12-17 19:31:5450
51
52OPTIONS
53-------
54
55-L <label>::
56This option may be given up to three times, and
57specifies labels to be used in place of the
58corresponding file names in conflict reports. That is,
Junio C Hamanofce7c7e2008-07-02 03:06:3859`git merge-file -L x -L y -L z a b c` generates output that
Junio C Hamano1de7bc62006-12-17 19:31:5460looks like it came from files x, y and z instead of
61from files a, b and c.
62
63-p::
64Send results to standard output instead of overwriting
65`<current-file>`.
66
67-q::
Junio C Hamanoec87f522008-12-10 08:35:2568Quiet; do not warn about conflicts.
Junio C Hamano1de7bc62006-12-17 19:31:5469
Junio C Hamano0241d052013-08-30 23:52:1770--diff3::
71Show conflicts in "diff3" style.
72
Junio C Hamano1aa40d22010-01-21 17:46:4373--ours::
74--theirs::
Junio C Hamano0299d922010-03-20 20:59:3175--union::
Junio C Hamano1aa40d22010-01-21 17:46:4376Instead of leaving conflicts in the file, resolve conflicts
Junio C Hamano0299d922010-03-20 20:59:3177favouring our (or their or both) side of the lines.
Junio C Hamano1aa40d22010-01-21 17:46:4378
Junio C Hamano1de7bc62006-12-17 19:31:5479
80EXAMPLES
81--------
82
Junio C Hamano16ebcd02011-08-05 00:05:4583`git merge-file README.my README README.upstream`::
Junio C Hamano1de7bc62006-12-17 19:31:5484
85combines the changes of README.my and README.upstream since README,
86tries to merge them and writes the result into README.my.
87
Junio C Hamano16ebcd02011-08-05 00:05:4588`git merge-file -L a -L b -L c tmp/a123 tmp/b234 tmp/c345`::
Junio C Hamano1de7bc62006-12-17 19:31:5489
90merges tmp/a123 and tmp/c345 with the base tmp/b234, but uses labels
91`a` and `c` instead of `tmp/a123` and `tmp/c345`.
92
Junio C Hamano1de7bc62006-12-17 19:31:5493GIT
94---
Junio C Hamanof7c042d2008-06-06 22:50:5395Part of the linkgit:git[1] suite