DIFF3
Show differences among three files.
When two people have made independent changes to a common original, &qt;diff3&qt;&qt; can report the differences between the original and the two changed versions, and can produce a merged file that contains both persons&qt;&qt; changes together with warnings about conflicts.
The files to compare are MINE, OLDER, and YOURS. At most one of these three file names may be &qt;-&qt;&qt;, which tells &qt;diff3&qt;&qt; to read the standard input for that file.
SYNTAX
diff3 [options] mine older yours
OPTIONS
&qt;-a&qt;&qt;
Treat all files as text and compare them line-by-line, even if they
do not appear to be text.
&qt;-A&qt;&qt;
Incorporate all changes from OLDER to YOURS into MINE, surrounding
all conflicts with bracket lines. *Note Marking Conflicts::.
&qt;-e&qt;&qt;
Generate an &qt;ed&qt;&qt; script that incorporates all the changes from
OLDER to YOURS into MINE. *Note Which Changes::.
&qt;-E&qt;&qt;
Like &qt;-e&qt;&qt;, except bracket lines from overlapping changes&qt;&qt; first
and third files. *Note Marking Conflicts::. With &qt;-e&qt;&qt;, an
overlapping change looks like this:
<<<<<<< MINE
lines from MINE
=======
lines from YOURS
>>>>>>> YOURS
&qt;–ed&qt;&qt;
Generate an &qt;ed&qt;&qt; script that incorporates all the changes from
OLDER to YOURS into MINE. *Note Which Changes::.
&qt;–easy-only&qt;&qt;
Like &qt;-e&qt;&qt;, except output only the nonoverlapping changes. *Note
Which Changes::.
&qt;-i&qt;&qt;
Generate &qt;w&qt;&qt; and &qt;q&qt;&qt; commands at the end of the &qt;ed&qt;&qt; script for
System V compatibility. This option must be combined with one of
the &qt;-AeExX3&qt;&qt; options, and may not be combined with &qt;-m&qt;&qt;. *Note
Saving the Changed File::.
&qt;–initial-tab&qt;&qt;
Output a tab rather than two spaces before the text of a line in
normal format. This causes the alignment of tabs in the line to
look normal. *Note Tabs::.
&qt;-L LABEL&qt;&qt;
&qt;–label=LABEL&qt;&qt;
Use the label LABEL for the brackets output by the &qt;-A&qt;&qt;, &qt;-E&qt;&qt; and
&qt;-X&qt;&qt; options. This option may be given up to three times, one for
each input file. The default labels are the names of the input
files. Thus &qt;diff3 -L X -L Y -L Z -m A B C&qt;&qt; acts like &qt;diff3 -m A
B C&qt;&qt;, except that the output looks like it came from files named
&qt;X&qt;&qt;, &qt;Y&qt;&qt; and &qt;Z&qt;&qt; rather than from files named &qt;A&qt;&qt;, &qt;B&qt;&qt; and &qt;C&qt;&qt;.
*Note Marking Conflicts::.
&qt;-m&qt;&qt;
&qt;–merge&qt;&qt;
Apply the edit script to the first file and send the result to
standard output. Unlike piping the output from &qt;diff3&qt;&qt; to &qt;ed&qt;&qt;,
this works even for binary files and incomplete lines. &qt;-A&qt;&qt; is
assumed if no edit script option is specified. *Note Bypassing
ed::.
&qt;–overlap-only&qt;&qt;
Like &qt;-e&qt;&qt;, except output only the overlapping changes. *Note
Which Changes::.
&qt;–show-all&qt;&qt;
Incorporate all unmerged changes from OLDER to YOURS into MINE,
surrounding all overlapping changes with bracket lines. *Note
Marking Conflicts::.
&qt;–show-overlap&qt;&qt;
Like &qt;-e&qt;&qt;, except bracket lines from overlapping changes&qt;&qt; first
and third files. *Note Marking Conflicts::.
&qt;-T&qt;&qt;
Output a tab rather than two spaces before the text of a line in
normal format. This causes the alignment of tabs in the line to
look normal. *Note Tabs::.
&qt;–text&qt;&qt;
Treat all files as text and compare them line-by-line, even if they
do not appear to be text. *Note Binary::.
&qt;-v&qt;&qt;
&qt;–version&qt;&qt;
Output the version number of &qt;diff3&qt;&qt;.
&qt;-x&qt;&qt;
Like &qt;-e&qt;&qt;, except output only the overlapping changes. *Note
Which Changes::.
&qt;-X&qt;&qt;
Like &qt;-E&qt;&qt;, except output only the overlapping changes. In other
words, like &qt;-x&qt;&qt;, except bracket changes as in &qt;-E&qt;&qt;. *Note
Marking Conflicts::.
&qt;-3&qt;&qt;
Like &qt;-e&qt;&qt;, except output only the nonoverlapping changes. Notes
&qt;diff3&qt;&qt; normally compares three input files line by line, finds groups of lines that differ, and reports each group of differing lines. Its output is designed to make it easy to inspect two different sets of changes to the same file.
If &qt;diff3&qt;&qt; thinks that any of the files it is comparing is binary (a non-text file), it normally reports an error, because such comparisons are usually not useful. As with &qt;diff&qt;&qt;, you can force &qt;diff3&qt;&qt; to consider all files to be text files and compare them line by line by using the &qt;-a&qt;&qt; or &qt;–text&qt;&qt; options.
Multiple single letter options (unless they take an argument) can be combined into a single command line argument.
An exit status of 0 means diff3 was successful, 1 means some conflicts were found, and 2 means trouble.
Hits: 0