.\" Copyright (c) 1990, 1993, 1994 .\" The Regents of the University of California. All rights reserved. .\" .\" %sccs.include.redist.roff% .\" .\" @(#)diff3.1 8.2 (Berkeley) 04/18/94 .\" .Dd .Dt DIFF3 1 .Os BSD 4.3R .Sh NAME .Nm diff3 .Nd 3-way differential file comparison .Sh SYNOPSIS .Nm diff3 .Op Fl exEX3 .Ar file1 file2 file3 .Sh DESCRIPTION The .Nm diff3 utility compares the contents of three different versions of a file, .Ar file1 , .Ar file2 and .Ar file3 , writing the result to the standard output. The options describe different methods of merging and purging the separate versions into a new file. .Nm Diff3 is used by .Xr RCS 1 to merge specific versions or create new versions. .Pp Options are: .Bl -tag -width "--E, --X" .It Fl e Produces output in a form suitable as an input script for the .Xr ed 1 utility. The script may then be used to merge differences common between all three files and differences specific to file1 and file3. In other words, the .Fl 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. .It Fl x Produces an output script suitable for .Xr ed 1 with changes specific only to all three versions. .It Fl 3 Produces an output script suitable for .Xr ed 1 with changes specific only to file3. .It Fl E , X Similar to .Fl e and .Fl x , respectively, but treat overlapping changes (i.e., 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. .El .Pp The .Fl E option is used by .Tn RCS .Xr merge 1 to insure that overlapping changes in the merged files are preserved and brought to someone's attention. .Pp For example, suppose lines 7-8 are changed in both file1 and file2. Applying the edit script generated by the command .Pp .Dl diff3 -E file1 file2 file3 .Pp to file1 results in the file: .Pp .Bd -literal -offset indent -compact lines 1-6 of file1 <<<<<<< file1 lines 7-8 of file1 ======= lines 7-8 of file3 >>>>>>> file3 rest of file1 .Ed .Pp The default output of .Nm diff3 makes notation of the differences between all files, and those differences specific to each pair of files. The changes are described by the commands necessary for .Xr ed 1 to create the desired target from the different versions. See .Xr diff 1 for a description of the commands. .Bl -tag -width "=====" .It Li \&==== The lines beneath this notation are ranges of lines which are different between all files. .It \&==== Ns Va n The lines beneath this notation are ranges of lines which are exclusively different in file .Va n . .El .Sh FILES .Bl -tag -width /usr/bin/diff3 -compact .It Pa /tmp/d3????? temporary files. .It Pa /usr/bin/diff3 the executable. .El .Sh SEE ALSO .Xr diff 1 .Xr ed 1 .Xr rcs 1 .Sh BUGS The .Fl e option cannot catch and change lines which have .Ql \&. as the first and only character on the line. The resulting script will fail on that line as .Ql \&. is an .Xr ed 1 editing command. .Sh HISTORY A .Nm command appeared in .At v7 .