diff3

NAME

diff3 - 3-way differential file comparison

SYNOPSIS

diff3 [-exEX3] file1 file2 file3

DESCRIPTION

The diff3(1) utility compares the contents of three different versions of a file, file1, file2 and file3, writing the result to the standard output. The options describe different methods of merging and purging the separate versions into a new file. The diff3(1) utility is used by the RCS commands to merge specific versions or create new versions.

OPTIONS

-e
Produce output in a form suitable as an input script for the ed(1) utility. The script CAN then be used to merge differences common between all three files and differences specific to file1 and file3. In other words, the -e option ignores differences specific to file1 and file2, and those specific to file2 and file3. It is useful for backing out changes specific to file2 only.
-x
Produce an output script suitable for ed(1) with changes specific only to all three versions.
-3
Produce an output script suitable for ed(1) with changes specific only to file3.
-E
Similar to -e but treat overlapping changes (that is, changes that would be noted with ==== in the normal listing) differently. The overlapping lines from both files will be inserted by the edit script, bracketed by "<<<<<<" and ">>>>>>" lines.
-X
Similar to -x, but treat overlapping changes (as described for -E) differently. The overlapping lines from both files will be inserted by the edit script, bracketed by "<<<<<<" and ">>>>>>" lines.

The -E option is used by RCS merge(1) to ensure that overlapping changes in the merged files are preserved and are therefore noticeable.

For example, suppose lines 7-8 are changed in both file1 and file2. Applying to file1 the edit script generated by the following command:

diff3 -E file1 file2 file3

results in the file:

lines 1-6
of file1
<<<<<<< file1
lines 7-8
of file1
=======
lines 7-8
of file3
>>>>>>> file3
rest of file1

The default output of diff3(1) makes notation of the differences between all files, as well as those differences specific to each pair of files. The changes are described by the commands necessary for ed(1) to create the desired target from the different versions. See diff(1) for a description of the commands.

====
The lines beneath this notation are ranges of lines that are different between all files.
====n
The lines beneath this notation are ranges of lines that are exclusively different in file n.

FILES

Diff3(1) uses of the following files:
/tmp/d3?????
Temporary files.
/bin/diff3
The executable. The root of the path depends upon where the Interix distribution is installed.

BUGS

The -e option cannot detect and change lines that have a period (.) as the first and only character on the line. The resulting script fails on that line because . is an ed(1) editing command.

SEE ALSO

diff(1)

ed(1)