1.\" Copyright (c) 1990, 1993, 1994 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.roff% 5.\" 6.\" @(#)diff3.1 8.2 (Berkeley) 04/18/94 7.\" 8.Dd 9.Dt DIFF3 1 10.Os BSD 4.3R 11.Sh NAME 12.Nm diff3 13.Nd 3-way differential file comparison 14.Sh SYNOPSIS 15.Nm diff3 16.Op Fl exEX3 17.Ar file1 file2 file3 18.Sh DESCRIPTION 19The 20.Nm diff3 21utility compares the contents of three different versions of a file, 22.Ar file1 , 23.Ar file2 24and 25.Ar file3 , 26writing the result to the standard output. 27The options describe different methods of merging and 28purging 29the separate versions into a new file. 30.Nm Diff3 31is used by 32.Xr RCS 1 33to merge specific versions or create 34new versions. 35.Pp 36Options are: 37.Bl -tag -width "--E, --X" 38.It Fl e 39Produces output in a form suitable as an input script for the 40.Xr ed 1 41utility. The script may then be used to merge differences common 42between all three files and differences specific to file1 and file3. 43In other words, the 44.Fl e 45option ignores differences specific to file1 and file2, and those 46specific to file2 and file3. It is useful for backing out changes 47specific to file2 only. 48.It Fl x 49Produces an output script suitable for 50.Xr ed 1 51with changes 52specific only to all three versions. 53.It Fl 3 54Produces an output script suitable for 55.Xr ed 1 56with changes 57specific only to file3. 58.It Fl E , X 59Similar to 60.Fl e 61and 62.Fl x , 63respectively, but treat overlapping changes (i.e., changes that would 64be noted with ==== in the normal listing) differently. The overlapping 65lines from both files will be inserted by the edit script, bracketed 66by "<<<<<<" and ">>>>>>" lines. 67.El 68.Pp 69The 70.Fl E 71option is used by 72.Tn RCS 73.Xr merge 1 74to insure that overlapping changes in the merged files are preserved 75and brought to someone's attention. 76.Pp 77For example, suppose lines 7-8 are changed in both file1 and file2. 78Applying the edit script generated by the command 79.Pp 80.Dl diff3 -E file1 file2 file3 81.Pp 82to file1 results in the file: 83.Pp 84.Bd -literal -offset indent -compact 85lines 1-6 86of file1 87<<<<<<< file1 88lines 7-8 89of file1 90======= 91lines 7-8 92of file3 93>>>>>>> file3 94rest of file1 95.Ed 96.Pp 97The default output of 98.Nm diff3 99makes notation of the differences between all files, and those differences 100specific to each pair of files. The 101changes are described by 102the commands necessary for 103.Xr ed 1 104to create the desired target from the different versions. 105See 106.Xr diff 1 107for a description of the commands. 108.Bl -tag -width "=====" 109.It Li \&==== 110The lines beneath this notation are ranges of lines which are different 111between all files. 112.It \&==== Ns Va n 113The lines beneath this notation are ranges of lines which are exclusively 114different in file 115.Va n . 116.El 117.Sh FILES 118.Bl -tag -width /usr/bin/diff3 -compact 119.It Pa /tmp/d3????? 120temporary files. 121.It Pa /usr/bin/diff3 122the executable. 123.El 124.Sh SEE ALSO 125.Xr diff 1 126.Xr ed 1 127.Xr rcs 1 128.Sh BUGS 129The 130.Fl e 131option 132cannot catch and change 133lines which have 134.Ql \&. 135as the first and only character on the line. 136The resulting script will fail on that line 137as 138.Ql \&. 139is an 140.Xr ed 1 141editing command. 142.Sh HISTORY 143A 144.Nm 145command appeared in 146.At v7 . 147