1*66875Sbostic.\" Copyright (c) 1990, 1993, 1994 261985Sbostic.\" The Regents of the University of California. All rights reserved. 319405Smckusick.\" 448697Scael.\" %sccs.include.redist.roff% 543687Scael.\" 6*66875Sbostic.\" @(#)diff3.1 8.2 (Berkeley) 04/18/94 743687Scael.\" 843687Scael.Dd 943687Scael.Dt DIFF3 1 1048697Scael.Os BSD 4.3R 1143687Scael.Sh NAME 1243687Scael.Nm diff3 1343687Scael.Nd 3-way differential file comparison 1443687Scael.Sh SYNOPSIS 1543687Scael.Nm diff3 1643687Scael.Op Fl exEX3 1743687Scael.Ar file1 file2 file3 1843687Scael.Sh DESCRIPTION 1924333SvanThe 2043687Scael.Nm diff3 2143687Scaelutility compares the contents of three different versions of a file, 2243687Scael.Ar file1 , 2343687Scael.Ar file2 2424333Svanand 2543687Scael.Ar file3 , 2643687Scaelwriting the result to the standard output. 2743687ScaelThe options describe different methods of merging and 2843687Scaelpurging 2943687Scaelthe separate versions into a new file. 3043687Scael.Nm Diff3 3143687Scaelis used by 3243687Scael.Xr RCS 1 3343687Scaelto merge specific versions or create 3443687Scaelnew versions. 3543687Scael.Pp 3643687ScaelOptions are: 3748697Scael.Bl -tag -width "--E, --X" 3848697Scael.It Fl e 3943687ScaelProduces output in a form suitable as an input script for the 4043687Scael.Xr ed 1 4143687Scaelutility. The script may then be used to merge differences common 4243687Scaelbetween all three files and differences specific to file1 and file3. 4343687ScaelIn other words, the 4443687Scael.Fl e 4543687Scaeloption ignores differences specific to file1 and file2, and those 4643687Scaelspecific to file2 and file3. It is useful for backing out changes 4743687Scaelspecific to file2 only. 4848697Scael.It Fl x 4943687ScaelProduces an output script suitable for 5043687Scael.Xr ed 1 5143687Scaelwith changes 5243687Scaelspecific only to all three versions. 5348697Scael.It Fl 3 5443687ScaelProduces an output script suitable for 5543687Scael.Xr ed 1 5643687Scaelwith changes 5743687Scaelspecific only to file3. 5848697Scael.It Fl E , X 5943687ScaelSimilar to 6043687Scael.Fl e 6124333Svanand 6243687Scael.Fl x , 6324333Svanrespectively, but treat overlapping changes (i.e., changes that would 6443687Scaelbe noted with ==== in the normal listing) differently. The overlapping 6524333Svanlines from both files will be inserted by the edit script, bracketed 6624333Svanby "<<<<<<" and ">>>>>>" lines. 6748697Scael.El 6843687Scael.Pp 6943687ScaelThe 7043687Scael.Fl E 7148697Scaeloption is used by 7248697Scael.Tn RCS 7343687Scael.Xr merge 1 7443687Scaelto insure that overlapping changes in the merged files are preserved 7543687Scaeland brought to someone's attention. 7643687Scael.Pp 7724333SvanFor example, suppose lines 7-8 are changed in both file1 and file2. 7824333SvanApplying the edit script generated by the command 7943687Scael.Pp 8043687Scael.Dl diff3 -E file1 file2 file3 8143687Scael.Pp 8224333Svanto file1 results in the file: 8348697Scael.Pp 8448697Scael.Bd -literal -offset indent -compact 8524333Svanlines 1-6 8624333Svanof file1 8724333Svan<<<<<<< file1 8824333Svanlines 7-8 8924333Svanof file1 9024333Svan======= 9124333Svanlines 7-8 9224333Svanof file3 9324333Svan>>>>>>> file3 9424333Svanrest of file1 9548697Scael.Ed 9643687Scael.Pp 9743687ScaelThe default output of 9843687Scael.Nm diff3 9943687Scaelmakes notation of the differences between all files, and those differences 10043687Scaelspecific to each pair of files. The 10143687Scaelchanges are described by 102*66875Sbosticthe commands necessary for 10343687Scael.Xr ed 1 10443687Scaelto create the desired target from the different versions. 10543687ScaelSee 10643687Scael.Xr diff 1 10743687Scaelfor a description of the commands. 10848697Scael.Bl -tag -width "=====" 10948697Scael.It Li \&==== 11043687ScaelThe lines beneath this notation are ranges of lines which are different 11143687Scaelbetween all files. 11248697Scael.It \&==== Ns Va n 11343687ScaelThe lines beneath this notation are ranges of lines which are exclusively 11443687Scaeldifferent in file 11543687Scael.Va n . 11648697Scael.El 11743687Scael.Sh FILES 11848697Scael.Bl -tag -width /usr/bin/diff3 -compact 11948697Scael.It Pa /tmp/d3????? 12043687Scaeltemporary files. 12148697Scael.It Pa /usr/bin/diff3 12243687Scaelthe executable. 12348697Scael.El 12443687Scael.Sh SEE ALSO 12543687Scael.Xr diff 1 12643687Scael.Xr ed 1 12743687Scael.Xr rcs 1 12843687Scael.Sh BUGS 12924333SvanThe 13043687Scael.Fl e 13143687Scaeloption 13243687Scaelcannot catch and change 13343687Scaellines which have 13448697Scael.Ql \&. 13548697Scaelas the first and only character on the line. 13643687ScaelThe resulting script will fail on that line 13748697Scaelas 13848697Scael.Ql \&. 13943687Scaelis an 14043687Scael.Xr ed 1 14143687Scaelediting command. 14248697Scael.Sh HISTORY 14348697ScaelA 14448697Scael.Nm 14548697Scaelcommand appeared in 14648697Scael.At v7 . 147