diffutils: diff3 Merging

1 
1 8 Merging From a Common Ancestor
1 ********************************
1 
1 When two people have made changes to copies of the same file, 'diff3'
1 can produce a merged output that contains both sets of changes together
1 with warnings about conflicts.
1 
1    One might imagine programs with names like 'diff4' and 'diff5' to
1 compare more than three files simultaneously, but in practice the need
1 rarely arises.  You can use 'diff3' to merge three or more sets of
1 changes to a file by merging two change sets at a time.
1 
1    'diff3' can incorporate changes from two modified versions into a
1 common preceding version.  This lets you merge the sets of changes
1 represented by the two newer files.  Specify the common ancestor version
1 as the second argument and the two newer versions as the first and third
1 arguments, like this:
1 
1      diff3 MINE OLDER YOURS
1 
1 You can remember the order of the arguments by noting that they are in
1 alphabetical order.
1 
1    You can think of this as subtracting OLDER from YOURS and adding the
1 result to MINE, or as merging into MINE the changes that would turn
1 OLDER into YOURS.  This merging is well-defined as long as MINE and
1 OLDER match in the neighborhood of each such change.  This fails to be
1 true when all three input files differ or when only OLDER differs; we
1 call this a "conflict".  When all three input files differ, we call the
1 conflict an "overlap".
1 
1    'diff3' gives you several ways to handle overlaps and conflicts.  You
1 can omit overlaps or conflicts, or select only overlaps, or mark
1 conflicts with special '<<<<<<<' and '>>>>>>>' lines.
1 
1    'diff3' can output the merge results as an 'ed' script that that can
1 be applied to the first file to yield the merged output.  However, it is
1 usually better to have 'diff3' generate the merged output directly; this
1 bypasses some problems with 'ed'.
1 

Menu