merge(1)

merge(1)

NAME

merge - three-way ®le merge

SYNOPSIS

merge [-p]®le1 ®le2 ®le3

DESCRIPTION

merge combines two ®les that are revisions of a single original ®le. The original ®le is ®le2, and the revised ®les are ®le1 and ®le3. merge identi®es all changes that lead from ®le2 to ®le3 and from ®le2 to ®le1, then deposits the merged text into ®le1. If the -poption is used, the result goes to standard output instead of ®le1.

An overlap occurs if both ®le1 and ®le3 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 ®le1

=======

lines in ®le3

>>>>>>> file3

If there are overlaps, edit the result in ®le1 and delete one of the alternatives.

This command is particularly useful for revision control, especially if ®le1 and ®le3 are the ends of two branches that have ®le2 as a common ancestor.

EXAMPLES

A typical use for merge is as follows:

1.To merge an RCS branch into the trunk, ®rst 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 ®le 5.2.

2.For this example, assume ®le 5.11 is the latest version on the trunk, and is also a revision of the "original" ®le, 5.2. Merge the branch into the trunk with the command:

merge 5.11 5.2 5.2.3.3

3.File 5.11 now contains all changes made on the branch and the trunk, and has markings in the ®le to show all overlapping changes.

4.Edit ®le 5.11 to correct the overlaps, then use the ci command to check the ®le back in (see ci(1)).

WARNINGS

merge uses the ed(1) system editor. Therefore, the ®le size limits of ed(1) apply to merge.

AUTHOR

merge was developed by Walter F. Tichy.

SEE ALSO

diff3(1), diff(1), rcsmerge(1), co(1).

m

HP-UX Release 11i: December 2000

− 1 −

Section 1527