notes-merge: use ssize_t for write_in_full() return value
[git.git] / Documentation / git-merge-file.txt
blobf85603261325f6f88b31c30b5fb2bafcded58d92
1 git-merge-file(1)
2 =================
4 NAME
5 ----
6 git-merge-file - Run a three-way file merge
9 SYNOPSIS
10 --------
11 [verse]
12 'git merge-file' [-L <current-name> [-L <base-name> [-L <other-name>]]]
13         [--ours|--theirs|--union] [-p|--stdout] [-q|--quiet] [--marker-size=<n>]
14         [--[no-]diff3] <current-file> <base-file> <other-file>
17 DESCRIPTION
18 -----------
19 'git merge-file' incorporates all changes that lead from the `<base-file>`
20 to `<other-file>` into `<current-file>`. The result ordinarily goes into
21 `<current-file>`. 'git merge-file' is useful for combining separate changes
22 to an original. Suppose `<base-file>` is the original, and both
23 `<current-file>` and `<other-file>` are modifications of `<base-file>`,
24 then 'git merge-file' combines both changes.
26 A conflict occurs if both `<current-file>` and `<other-file>` have changes
27 in a common segment of lines. If a conflict is found, 'git merge-file'
28 normally outputs a warning and brackets the conflict with lines containing
29 <<<<<<< and >>>>>>> markers. A typical conflict will look like this:
31         <<<<<<< A
32         lines in file A
33         =======
34         lines in file B
35         >>>>>>> B
37 If there are conflicts, the user should edit the result and delete one of
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.
43 The exit value of this program is negative on error, and the number of
44 conflicts otherwise (truncated to 127 if there are more than that many
45 conflicts). If the merge was clean, the exit value is 0.
47 'git merge-file' is designed to be a minimal clone of RCS 'merge'; that is, it
48 implements all of RCS 'merge''s functionality which is needed by
49 linkgit:git[1].
52 OPTIONS
53 -------
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,
59         `git merge-file -L x -L y -L z a b c` generates output that
60         looks like it came from files x, y and z instead of
61         from files a, b and c.
63 -p::
64         Send results to standard output instead of overwriting
65         `<current-file>`.
67 -q::
68         Quiet; do not warn about conflicts.
70 --diff3::
71         Show conflicts in "diff3" style.
73 --ours::
74 --theirs::
75 --union::
76         Instead of leaving conflicts in the file, resolve conflicts
77         favouring our (or their or both) side of the lines.
80 EXAMPLES
81 --------
83 `git merge-file README.my README README.upstream`::
85         combines the changes of README.my and README.upstream since README,
86         tries to merge them and writes the result into README.my.
88 `git merge-file -L a -L b -L c tmp/a123 tmp/b234 tmp/c345`::
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`.
93 GIT
94 ---
95 Part of the linkgit:git[1] suite