]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-merge-file.txt
path.c: clarify trie_find()'s in-code comment
[thirdparty/git.git] / Documentation / git-merge-file.txt
CommitLineData
9abaa7f0 1git-merge-file(1)
38477d9e 2=================
9abaa7f0
JS
3
4NAME
5----
c3f0baac 6git-merge-file - Run a three-way file merge
9abaa7f0
JS
7
8
9SYNOPSIS
10--------
11[verse]
b1889c36 12'git merge-file' [-L <current-name> [-L <base-name> [-L <other-name>]]]
3a15048d 13 [--ours|--theirs|--union] [-p|--stdout] [-q|--quiet] [--marker-size=<n>]
67ed84f3 14 [--[no-]diff3] <current-file> <base-file> <other-file>
9abaa7f0
JS
15
16
17DESCRIPTION
18-----------
0b444cdb 19'git merge-file' incorporates all changes that lead from the `<base-file>`
9abaa7f0 20to `<other-file>` into `<current-file>`. The result ordinarily goes into
0b444cdb 21`<current-file>`. 'git merge-file' is useful for combining separate changes
9abaa7f0 22to an original. Suppose `<base-file>` is the original, and both
29b802aa 23`<current-file>` and `<other-file>` are modifications of `<base-file>`,
0b444cdb 24then 'git merge-file' combines both changes.
9abaa7f0
JS
25
26A conflict occurs if both `<current-file>` and `<other-file>` have changes
0b444cdb 27in a common segment of lines. If a conflict is found, 'git merge-file'
29b802aa
RW
28normally outputs a warning and brackets the conflict with lines containing
29<<<<<<< and >>>>>>> markers. A typical conflict will look like this:
9abaa7f0
JS
30
31 <<<<<<< A
32 lines in file A
33 =======
34 lines in file B
35 >>>>>>> B
36
37If there are conflicts, the user should edit the result and delete one of
3a15048d
BW
38the 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.
9abaa7f0
JS
42
43The exit value of this program is negative on error, and the number of
e34f8027
JK
44conflicts otherwise (truncated to 127 if there are more than that many
45conflicts). If the merge was clean, the exit value is 0.
9abaa7f0 46
0b444cdb 47'git merge-file' is designed to be a minimal clone of RCS 'merge'; that is, it
2fd02c92 48implements all of RCS 'merge''s functionality which is needed by
5162e697 49linkgit:git[1].
9abaa7f0
JS
50
51
52OPTIONS
53-------
54
55-L <label>::
56 This option may be given up to three times, and
57 specifies labels to be used in place of the
58 corresponding file names in conflict reports. That is,
b1889c36 59 `git merge-file -L x -L y -L z a b c` generates output that
9abaa7f0
JS
60 looks like it came from files x, y and z instead of
61 from files a, b and c.
62
63-p::
64 Send results to standard output instead of overwriting
65 `<current-file>`.
66
67-q::
29b802aa 68 Quiet; do not warn about conflicts.
9abaa7f0 69
67ed84f3
RT
70--diff3::
71 Show conflicts in "diff3" style.
72
73eb40ee
JH
73--ours::
74--theirs::
3a15048d 75--union::
73eb40ee 76 Instead of leaving conflicts in the file, resolve conflicts
3a15048d 77 favouring our (or their or both) side of the lines.
73eb40ee 78
9abaa7f0
JS
79
80EXAMPLES
81--------
82
5d2fc913 83`git merge-file README.my README README.upstream`::
9abaa7f0
JS
84
85 combines the changes of README.my and README.upstream since README,
86 tries to merge them and writes the result into README.my.
87
5d2fc913 88`git merge-file -L a -L b -L c tmp/a123 tmp/b234 tmp/c345`::
9abaa7f0
JS
89
90 merges 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
9abaa7f0
JS
93GIT
94---
9e1f0a85 95Part of the linkgit:git[1] suite