NAME [Toc] [Back]
merge - three-way file merge
SYNOPSIS [Toc] [Back]
merge [-p] file1 file2 file3
DESCRIPTION [Toc] [Back]
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
lines in file1
lines in file3
If there are overlaps, edit the result in file1 and delete one of the
This command is particularly useful for revision control, especially
if file1 and file3 are the ends of two branches that have file2 as a
EXAMPLES [Toc] [Back]
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 220.127.116.11.
File 18.104.22.168 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:
merge 5.11 5.2 22.214.171.124
3. File 5.11 now contains all changes made on the branch and
the trunk, and has markings in the file to show all
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
4. Edit file 5.11 to correct the overlaps, then use the ci
command to check the file back in (see ci(1)).
WARNINGS [Toc] [Back]
merge uses the ed(1) system editor. Therefore, the file size limits
of ed(1) apply to merge.
AUTHOR [Toc] [Back]
merge was developed by Walter F. Tichy.
SEE ALSO [Toc] [Back]
diff3(1), diff(1), rcsmerge(1), co(1).
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003 [ Back ]