git-merge-file.txt 2.72 KB
Newer Older
1
git-merge-file(1)
2
=================
3 4 5

NAME
----
6
git-merge-file - Run a three-way file merge
7 8 9 10 11


SYNOPSIS
--------
[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
	<current-file> <base-file> <other-file>
15 16 17 18


DESCRIPTION
-----------
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.
25 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 29
normally outputs a warning and brackets the conflict with lines containing
<<<<<<< and >>>>>>> markers. A typical conflict will look like this:
30 31 32 33 34 35 36 37

	<<<<<<< A
	lines in file A
	=======
	lines in file B
	>>>>>>> B

If there are conflicts, the user should edit the result and delete one of
38 39 40 41
the alternatives.  When `--ours`, `--theirs`, or `--union` option is in effect,
however, these conflicts are resolved favouring lines from `<current-file>`,
lines from `<other-file>`, or lines from both respectively.  The length of the
conflict markers can be given with the `--marker-size` option.
42 43 44 45

The exit value of this program is negative on error, and the number of
conflicts otherwise. If the merge was clean, the exit value is 0.

46
'git merge-file' is designed to be a minimal clone of RCS 'merge'; that is, it
47
implements all of RCS 'merge''s functionality which is needed by
48
linkgit:git[1].
49 50 51 52 53 54 55 56 57


OPTIONS
-------

-L <label>::
	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,
58
	`git merge-file -L x -L y -L z a b c` generates output that
59 60 61 62 63 64 65 66
	looks like it came from files x, y and z instead of
	from files a, b and c.

-p::
	Send results to standard output instead of overwriting
	`<current-file>`.

-q::
67
	Quiet; do not warn about conflicts.
68

69 70
--ours::
--theirs::
71
--union::
72
	Instead of leaving conflicts in the file, resolve conflicts
73
	favouring our (or their or both) side of the lines.
74

75 76 77 78

EXAMPLES
--------

79
`git merge-file README.my README README.upstream`::
80 81 82 83

	combines the changes of README.my and README.upstream since README,
	tries to merge them and writes the result into README.my.

84
`git merge-file -L a -L b -L c tmp/a123 tmp/b234 tmp/c345`::
85 86 87 88 89 90

	merges tmp/a123 and tmp/c345 with the base tmp/b234, but uses labels
	`a` and `c` instead of `tmp/a123` and `tmp/c345`.

GIT
---
91
Part of the linkgit:git[1] suite