blob: d7db2a3737fbdb032747bc6dd2740be1a56dfced [file] [log] [blame]
Junio C Hamano1de7bc62006-12-17 19:31:541git-merge-file(1)
2=================
3
4NAME
5----
Junio C Hamano7c73c662007-01-19 00:37:506git-merge-file - Run a three-way file merge
Junio C Hamano1de7bc62006-12-17 19:31:547
8
9SYNOPSIS
10--------
11[verse]
Junio C Hamanofce7c7e2008-07-02 03:06:3812'git merge-file' [-L <current-name> [-L <base-name> [-L <other-name>]]]
Junio C Hamano0299d922010-03-20 20:59:3113[--ours|--theirs|--union] [-p|--stdout] [-q|--quiet] [--marker-size=<n>]
Junio C Hamano1aa40d22010-01-21 17:46:4314<current-file> <base-file> <other-file>
Junio C Hamano1de7bc62006-12-17 19:31:5415
16
17DESCRIPTION
18-----------
Junio C Hamano1aa40d22010-01-21 17:46:4319'git merge-file' incorporates all changes that lead from the `<base-file>`
Junio C Hamano1de7bc62006-12-17 19:31:5420to `<other-file>` into `<current-file>`. The result ordinarily goes into
Junio C Hamano1aa40d22010-01-21 17:46:4321`<current-file>`. 'git merge-file' is useful for combining separate changes
Junio C Hamano1de7bc62006-12-17 19:31:5422to an original. Suppose `<base-file>` is the original, and both
Junio C Hamanoec87f522008-12-10 08:35:2523`<current-file>` and `<other-file>` are modifications of `<base-file>`,
Junio C Hamano1aa40d22010-01-21 17:46:4324then 'git merge-file' combines both changes.
Junio C Hamano1de7bc62006-12-17 19:31:5425
26A conflict occurs if both `<current-file>` and `<other-file>` have changes
Junio C Hamano1aa40d22010-01-21 17:46:4327in a common segment of lines. If a conflict is found, 'git merge-file'
Junio C Hamanoec87f522008-12-10 08:35:2528normally outputs a warning and brackets the conflict with lines containing
29<<<<<<< and >>>>>>> markers. A typical conflict will look like this:
Junio C Hamano1de7bc62006-12-17 19:31:5430
31<<<<<<< A
32lines in file A
33=======
34lines in file B
35>>>>>>> B
36
37If there are conflicts, the user should edit the result and delete one of
Junio C Hamano0299d922010-03-20 20:59:3138the alternatives. When `--ours`, `--theirs`, or `--union` option is in effect,
39however, these conflicts are resolved favouring lines from `<current-file>`,
40lines from `<other-file>`, or lines from both respectively. The length of the
41conflict markers can be given with the `--marker-size` option.
Junio C Hamano1de7bc62006-12-17 19:31:5442
43The exit value of this program is negative on error, and the number of
44conflicts otherwise. If the merge was clean, the exit value is 0.
45
Junio C Hamano1aa40d22010-01-21 17:46:4346'git merge-file' is designed to be a minimal clone of RCS 'merge'; that is, it
Junio C Hamanoba4b9282008-07-06 05:20:3147implements all of RCS 'merge''s functionality which is needed by
Junio C Hamano35738e82008-01-07 07:55:4648linkgit:git[1].
Junio C Hamano1de7bc62006-12-17 19:31:5449
50
51OPTIONS
52-------
53
54-L <label>::
55This option may be given up to three times, and
56specifies labels to be used in place of the
57corresponding file names in conflict reports. That is,
Junio C Hamanofce7c7e2008-07-02 03:06:3858`git merge-file -L x -L y -L z a b c` generates output that
Junio C Hamano1de7bc62006-12-17 19:31:5459looks like it came from files x, y and z instead of
60from files a, b and c.
61
62-p::
63Send results to standard output instead of overwriting
64`<current-file>`.
65
66-q::
Junio C Hamanoec87f522008-12-10 08:35:2567Quiet; do not warn about conflicts.
Junio C Hamano1de7bc62006-12-17 19:31:5468
Junio C Hamano1aa40d22010-01-21 17:46:4369--ours::
70--theirs::
Junio C Hamano0299d922010-03-20 20:59:3171--union::
Junio C Hamano1aa40d22010-01-21 17:46:4372Instead of leaving conflicts in the file, resolve conflicts
Junio C Hamano0299d922010-03-20 20:59:3173favouring our (or their or both) side of the lines.
Junio C Hamano1aa40d22010-01-21 17:46:4374
Junio C Hamano1de7bc62006-12-17 19:31:5475
76EXAMPLES
77--------
78
Junio C Hamano16ebcd02011-08-05 00:05:4579`git merge-file README.my README README.upstream`::
Junio C Hamano1de7bc62006-12-17 19:31:5480
81combines the changes of README.my and README.upstream since README,
82tries to merge them and writes the result into README.my.
83
Junio C Hamano16ebcd02011-08-05 00:05:4584`git merge-file -L a -L b -L c tmp/a123 tmp/b234 tmp/c345`::
Junio C Hamano1de7bc62006-12-17 19:31:5485
86merges tmp/a123 and tmp/c345 with the base tmp/b234, but uses labels
87`a` and `c` instead of `tmp/a123` and `tmp/c345`.
88
Junio C Hamano1de7bc62006-12-17 19:31:5489GIT
90---
Junio C Hamanof7c042d2008-06-06 22:50:5391Part of the linkgit:git[1] suite