interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / Documentation / git-merge-file.adoc

125 lines · 4213 bytes Raw Blame History
1git-merge-file(1)
2=================
3
4NAME
5----
6git-merge-file - Run a three-way file merge
7
8
9SYNOPSIS
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] [--object-id] <current> <base> <other>
15
16
17DESCRIPTION
18-----------
19Given three files `<current>`, `<base>` and `<other>`,
20'git merge-file' incorporates all changes that lead from `<base>`
21to `<other>` into `<current>`. The result ordinarily goes into
22`<current>`. 'git merge-file' is useful for combining separate changes
23to an original. Suppose `<base>` is the original, and both
24`<current>` and `<other>` are modifications of `<base>`,
25then 'git merge-file' combines both changes.
26
27A conflict occurs if both `<current>` and `<other>` have changes
28in a common segment of lines. If a conflict is found, 'git merge-file'
29normally outputs a warning and brackets the conflict with lines containing
30<<<<<<< and >>>>>>> markers. A typical conflict will look like this:
31
32 <<<<<<< A
33 lines in file A
34 =======
35 lines in file B
36 >>>>>>> B
37
38If there are conflicts, the user should edit the result and delete one of
39the alternatives. When `--ours`, `--theirs`, or `--union` option is in effect,
40however, these conflicts are resolved favouring lines from `<current>`,
41lines from `<other>`, or lines from both respectively. The length of the
42conflict markers can be given with the `--marker-size` option.
43
44If `--object-id` is specified, exactly the same behavior occurs, except that
45instead of specifying what to merge as files, it is specified as a list of
46object IDs referring to blobs.
47
48The exit value of this program is negative on error, and the number of
49conflicts otherwise (truncated to 127 if there are more than that many
50conflicts). If the merge was clean, the exit value is 0.
51
52'git merge-file' is designed to be a minimal clone of RCS 'merge'; that is, it
53implements all of RCS 'merge''s functionality which is needed by
54linkgit:git[1].
55
56
57OPTIONS
58-------
59
60--object-id::
61 Specify the contents to merge as blobs in the current repository instead of
62 files. In this case, the operation must take place within a valid repository.
63+
64If the `-p` option is specified, the merged file (including conflicts, if any)
65goes to standard output as normal; otherwise, the merged file is written to the
66object store and the object ID of its blob is written to standard output.
67
68-L <label>::
69 This option may be given up to three times, and
70 specifies labels to be used in place of the
71 corresponding file names in conflict reports. That is,
72 `git merge-file -L x -L y -L z a b c` generates output that
73 looks like it came from files x, y and z instead of
74 from files a, b and c.
75
76-p::
77 Send results to standard output instead of overwriting
78 `<current>`.
79
80-q::
81 Quiet; do not warn about conflicts.
82
83--diff3::
84 Show conflicts in "diff3" style.
85
86--zdiff3::
87 Show conflicts in "zdiff3" style.
88+
89The `--diff3` and `--zdiff3` options default to the value of the
90`merge.conflictStyle` configuration variable (see linkgit:git-config[1]).
91
92--ours::
93--theirs::
94--union::
95 Instead of leaving conflicts in the file, resolve conflicts
96 favouring our (or their or both) side of the lines.
97
98--diff-algorithm={patience|minimal|histogram|myers}::
99 Use a different diff algorithm while merging. The current default is "myers",
100 but selecting more recent algorithm such as "histogram" can help
101 avoid mismerges that occur due to unimportant matching lines
102 (such as braces from distinct functions). See also
103 linkgit:git-diff[1] `--diff-algorithm`.
104
105EXAMPLES
106--------
107
108`git merge-file README.my README README.upstream`::
109
110 combines the changes of README.my and README.upstream since README,
111 tries to merge them and writes the result into README.my.
112
113`git merge-file -L a -L b -L c tmp/a123 tmp/b234 tmp/c345`::
114
115 merges tmp/a123 and tmp/c345 with the base tmp/b234, but uses labels
116 `a` and `c` instead of `tmp/a123` and `tmp/c345`.
117
118`git merge-file -p --object-id abc1234 def567 890abcd`::
119
120 combines the changes of the blob abc1234 and 890abcd since def567,
121 tries to merge them and writes the result to standard output
122
123GIT
124---
125Part of the linkgit:git[1] suite