- publishing free software manuals
Comparing and Merging Files with GNU diff and patch
by David MacKenzie, Paul Eggert, and Richard Stallman
Paperback (6"x9"), 120 pages
ISBN 0954161750
RRP £12.95 ($19.95)

"Well packaged... the quality of information is excellent" --- Linux User and Developer Magazine (Issue 36, Feb 2004) Get a printed copy>>>

8.1 Selecting Which Changes to Incorporate

You can select all unmerged changes from older to yours for merging into mine with the -e or --ed option. You can select only the nonoverlapping unmerged changes with -3 or --easy-only, and you can select only the overlapping changes with -x or --overlap-only.

The -e, -3 and -x options select only unmerged changes, i.e. changes where mine and yours differ; they ignore changes from older to yours where mine and yours are identical, because they assume that such changes have already been merged. If this assumption is not a safe one, you can use the -A or --show-all option (see section 8.2 Marking Conflicts).

Here is the output of the command diff3 with each of these three options (see section 7.1 A Third Sample Input File, for the complete contents of the files). Notice that -e outputs the union of the disjoint sets of changes output by -3 and -x.

Output of ‘diff3 -e lao tzu tao’:

11a

  -- The Way of Lao-Tzu, tr. Wing-tsit Chan
.
8c
  so we may see their result.
.

Output of ‘diff3 -3 lao tzu tao’:

8c
  so we may see their result.
.

Output of ‘diff3 -x lao tzu tao’:

11a

  -- The Way of Lao-Tzu, tr. Wing-tsit Chan
.
ISBN 0954161750Comparing and Merging Files with GNU diff and patchSee the print edition