DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(diff.info.gz) diff3 Merging

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

Menu

 
* Which Changes            Selecting changes to incorporate.
* Marking Conflicts        Marking conflicts.
* Bypassing ed             Generating merged output directly.
* Merging Incomplete Lines How `diff3' merges incomplete lines.
* Saving the Changed File  Emulating System V behavior.
 
Info Catalog (diff.info.gz) Comparing Three Files (diff.info.gz) Top (diff.info.gz) Interactive Merging
automatically generated byinfo2html