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