UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: identChapter 19
The Revision Control System
Next: Reference: rcs
 

merge

merge [options] [diff3 options] file1 file2 file3

Perform a three-way merge of files (via diff3) and place changes in file1. file2 is the original file. file1 is the "good" modification of file2. file3 is another, conflicting modification of file2. merge finds the differences between file2 and file3, and then incorporates those changes into file1. If both file1 and file3 have changes to common lines, merge warns about overlapping lines and inserts both choices in file1. The insertion appears as follows:

<<<<<<< file1
lines from file1</>
========
lines from file3
>>>>>>> file3

You'll need to edit file1 by deleting one of the choices. merge exits with a status of 0 (no overlaps), 1 (some overlaps), or 2 (unknown problem). See also rcsmerge.

merge accepts the -A, -e, and -E options for diff3, and simply passes them on, causing diff3 to perform the corresponding kind of merge. See the entry for diff3 in Chapter 2, Unix Commands, for details. (The -A option is for the GNU version of diff3.)

Options

-L label

This option may be provided up to three times, providing different labels in place of the filenames file1, file2, and file3, respectively.

-p

Send merged version to standard output instead of to file1.

-q

Produce overlap insertions but don't warn about them.


Previous: Reference: identUNIX in a Nutshell: System V EditionNext: Reference: rcs
Reference: identBook IndexReference: rcs

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System