2 .\" Title: git-merge-file
3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
7 .\" Source: Git 2.45.2.457.g8d94cfb545
10 .TH "GIT\-MERGE\-FILE" "1" "2024\-06\-10" "Git 2\&.45\&.2\&.457\&.g8d94cf" "Git Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 git-merge-file \- Run a three\-way file merge
35 \fIgit merge\-file\fR [\-L <current\-name> [\-L <base\-name> [\-L <other\-name>]]]
36 [\-\-ours|\-\-theirs|\-\-union] [\-p|\-\-stdout] [\-q|\-\-quiet] [\-\-marker\-size=<n>]
37 [\-\-[no\-]diff3] [\-\-object\-id] <current> <base> <other>
42 Given three files \fB<current>\fR, \fB<base>\fR and \fB<other>\fR, \fIgit merge\-file\fR incorporates all changes that lead from \fB<base>\fR to \fB<other>\fR into \fB<current>\fR\&. The result ordinarily goes into \fB<current>\fR\&. \fIgit merge\-file\fR is useful for combining separate changes to an original\&. Suppose \fB<base>\fR is the original, and both \fB<current>\fR and \fB<other>\fR are modifications of \fB<base>\fR, then \fIgit merge\-file\fR combines both changes\&.
44 A conflict occurs if both \fB<current>\fR and \fB<other>\fR have changes in a common segment of lines\&. If a conflict is found, \fIgit merge\-file\fR normally outputs a warning and brackets the conflict with lines containing <<<<<<< and >>>>>>> markers\&. A typical conflict will look like this:
60 If there are conflicts, the user should edit the result and delete one of the alternatives\&. When \fB\-\-ours\fR, \fB\-\-theirs\fR, or \fB\-\-union\fR option is in effect, however, these conflicts are resolved favouring lines from \fB<current>\fR, lines from \fB<other>\fR, or lines from both respectively\&. The length of the conflict markers can be given with the \fB\-\-marker\-size\fR option\&.
62 If \fB\-\-object\-id\fR is specified, exactly the same behavior occurs, except that instead of specifying what to merge as files, it is specified as a list of object IDs referring to blobs\&.
64 The exit value of this program is negative on error, and the number of conflicts otherwise (truncated to 127 if there are more than that many conflicts)\&. If the merge was clean, the exit value is 0\&.
66 \fIgit merge\-file\fR is designed to be a minimal clone of RCS \fImerge\fR; that is, it implements all of RCS \fImerge\fR\*(Aqs functionality which is needed by \fBgit\fR(1)\&.
71 Specify the contents to merge as blobs in the current repository instead of files\&. In this case, the operation must take place within a valid repository\&.
75 option is specified, the merged file (including conflicts, if any) goes to standard output as normal; otherwise, the merged file is written to the object store and the object ID of its blob is written to standard output\&.
80 This option may be given up to three times, and specifies labels to be used in place of the corresponding file names in conflict reports\&. That is,
81 \fBgit merge\-file \-L x \-L y \-L z a b c\fR
82 generates output that looks like it came from files x, y and z instead of from files a, b and c\&.
87 Send results to standard output instead of overwriting
93 Quiet; do not warn about conflicts\&.
98 Show conflicts in "diff3" style\&.
103 Show conflicts in "zdiff3" style\&.
106 \-\-ours, \-\-theirs, \-\-union
108 Instead of leaving conflicts in the file, resolve conflicts favouring our (or their or both) side of the lines\&.
111 \-\-diff\-algorithm={patience|minimal|histogram|myers}
113 Use a different diff algorithm while merging\&. The current default is "myers", but selecting more recent algorithm such as "histogram" can help avoid mismerges that occur due to unimportant matching lines (such as braces from distinct functions)\&. See also
115 \fB\-\-diff\-algorithm\fR\&.
119 \fBgit merge\-file README\&.my README README\&.upstream\fR
121 combines the changes of README\&.my and README\&.upstream since README, tries to merge them and writes the result into README\&.my\&.
124 \fBgit merge\-file \-L a \-L b \-L c tmp/a123 tmp/b234 tmp/c345\fR
126 merges tmp/a123 and tmp/c345 with the base tmp/b234, but uses labels
136 \fBgit merge\-file \-p \-\-object\-id abc1234 def567 890abcd\fR
138 combines the changes of the blob abc1234 and 890abcd since def567, tries to merge them and writes the result to standard output
142 Part of the \fBgit\fR(1) suite