NAME
merge — three-way file merge
SYNOPSIS
merge
[-p]
file1 file2 file3
DESCRIPTION
merge
combines two files that are revisions of a single original file.
The original file is
file2,
and the revised files are
file1
and
file3.
merge
identifies all changes that lead from
file2
to
file3
and from
file2
to
file1,
then deposits the merged text into
file1.
If the
-p
option is used, the result goes to standard output instead of
file1.
An overlap occurs if both
file1
and
file3
have changes in the same place.
merge
prints how many overlaps occurred,
and includes both alternatives in the result.
The alternatives are delimited as follows:
<<<<<<< file1
lines in file1
=======
lines in file3
>>>>>>> file3
If there are overlaps, edit the result in
file1
and delete one of the alternatives.
This command is particularly useful for revision control,
especially if
file1
and
file3
are the ends of two branches that have
file2
as a common ancestor.
EXAMPLES
A typical use for
merge
is as follows:
- 1.
To merge an
RCS
branch into the trunk,
first check out the three different versions from
RCS
(see
co(1))
and rename them for their revision numbers: 5.2, 5.11, and 5.2.3.3.
File 5.2.3.3 is the end of an
RCS
branch that split off the trunk at file 5.2.
- 2.
For this example, assume file 5.11 is the latest version on the trunk,
and is also a revision of the "original" file, 5.2.
Merge the branch into the trunk with the command:
- 3.
File 5.11 now contains all changes made on the branch and the trunk,
and has markings in the file to show all overlapping changes.
- 4.
Edit file 5.11 to correct the overlaps, then use the
ci
command to check the file back in (see
ci(1)).
WARNINGS
merge
uses the
ed(1)
system editor.
Therefore, the file size limits of
ed(1)
apply to
merge.
AUTHOR
merge
was developed by Walter F. Tichy.