1 .\" $OpenBSD: diff3.1,v 1.7 2007/05/31 19:20:09 jmc Exp $
3 .\" Copyright (c) 1990, 1993, 1994
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. Neither the name of the University nor the names of its contributors
15 .\" may be used to endorse or promote products derived from this software
16 .\" without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" @(#)diff3.1 8.2 (Berkeley) 4/18/94
38 .Nd 3-way differential file comparison
42 .Op Fl Fl diff-program Ar program
43 .Op Fl Fl strip-trailing-cr
44 .Op Fl L | Fl Fl label Ar label1
45 .Op Fl L | Fl Fl label Ar label2
46 .Op Fl L | Fl Fl label Ar label3
54 utility compares the contents of three different versions of a file,
59 writing the result to the standard output.
60 The options describe different methods of merging and
62 the separate versions into a new file.
66 to merge specific versions or create
69 The options are as follows:
70 .Bl -tag -width "-E, -X"
71 .It Fl 3 , Fl Fl easy-only
72 Produces an output script suitable for
77 .It Fl A Fl Fl show-all
78 Output all changes, bracketing conflicts.
80 Treat all files as ASCII.
81 .It Fl E , Fl Fl show-overlap
87 respectively, but treat overlapping changes (i.e., changes that would
88 be noted with ==== in the normal listing) differently.
89 The overlapping lines from both files will be inserted by the edit script,
90 bracketed by "<<<<<<" and ">>>>>>" lines.
92 Produces output in a form suitable as an input script for the
95 The script may then be used to merge differences common between all
96 three files and differences specific to
102 option ignores differences specific to
106 and those specific to
110 It is useful for backing out changes specific to
114 Prints usage information and exits.
119 .It Fl L , Fl Fl label
120 Defines labels to print instead of file names
125 .It Fl m, Fl Fl merge
126 Merge output instead of generating ed script.
127 .It Fl T, Fl Fl initial-tab
128 In the normal listing,
129 use a tab instead of two spaces
130 at the beginning of each line.
131 In modes that produce an
133 script, this option changes nothing.
134 .It Fl x, Fl Fl overlap-only
135 Produces an output script suitable for
138 specific only to all three versions.
139 .It Fl Fl diff-program Ar program
142 instead of the default
145 .It Fl Fl strip-trailing-cr
146 Strip trailing carriage return on input files.
148 Prints version information and exits.
156 to ensure that overlapping changes in the merged files are preserved
157 and brought to someone's attention.
159 For example, suppose lines 7-8 are changed in both
163 Applying the edit script generated by the command
165 .Dl $ diff3 -E file1 file2 file3
170 .Bd -literal -offset indent
183 The default output of
185 makes notation of the differences between all files, and those
186 differences specific to each pair of files.
187 The changes are described by the commands necessary for
189 to create the desired target from the different versions.
192 for a description of the commands.
193 .Bl -tag -width "====="
195 The lines beneath this notation are ranges of lines which are different
198 The lines beneath this notation are ranges of lines which are exclusively
216 option cannot catch and change lines which have
218 as the first and only character on the line.
219 The resulting script will fail on that line