home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / info / diff.info-1 (.txt) < prev    next >
GNU Info File  |  1994-12-22  |  48KB  |  907 lines

  1. This is Info file diff.info, produced by Makeinfo-1.55 from the input
  2. file ./diff.texi.
  3.    This file documents the the GNU `diff', `diff3', `sdiff', and `cmp'
  4. commands for showing the differences between text files and the `patch'
  5. command for using their output to update files.
  6.    Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided that
  12. the entire resulting derived work is distributed under the terms of a
  13. permission notice identical to this one.
  14.    Permission is granted to copy and distribute translations of this
  15. manual into another language, under the above conditions for modified
  16. versions, except that this permission notice may be stated in a
  17. translation approved by the Foundation.
  18. File: diff.info,  Node: Top,  Up: (dir)
  19.    This file documents the the GNU `diff', `diff3', `sdiff', and `cmp'
  20. commands for showing the differences between text files and the `patch'
  21. command for using their output to update files.
  22.    This is Edition 1.2, for `diff' 2.4 and `patch' 2.1.
  23. * Menu:
  24. * Overview::        Preliminary information.
  25. * Comparison::        What file comparison means.
  26. * Output Formats::    Formats for difference reports.
  27. * Comparing Directories::    Comparing files and directories.
  28. * Adjusting Output::    Making `diff' output prettier.
  29. * diff Performance::    Making `diff' smarter or faster.
  30. * Comparing Three Files:: Formats for three-way difference reports.
  31. * diff3 Merging::    Merging from a common ancestor.
  32. * Interactive Merging::    Interactive merging with `sdiff'.
  33. * Merging with patch::    Using `patch' to change old files into new ones.
  34. * Making Patches::    Tips for making patch distributions.
  35. * Invoking cmp::    How to run `cmp' and a summary of its options.
  36. * Invoking diff::    How to run `diff' and a summary of its options.
  37. * Invoking diff3::    How to run `diff3' and a summary of its options.
  38. * Invoking patch::    How to run `patch' and a summary of its options.
  39. * Invoking sdiff::    How to run `sdiff' and a summary of its options.
  40. * Incomplete Lines::    Lines that lack trailing newlines.
  41. * Projects::        If you think you've found a bug or other shortcoming.
  42. * Concept Index::    Index of concepts.
  43. File: diff.info,  Node: Overview,  Next: Comparison,  Up: Top
  44. Overview
  45. ********
  46.    Computer users often find occasion to ask how two files differ.
  47. Perhaps one file is a newer version of the other file.  Or maybe the
  48. two files started out as identical copies but were changed by different
  49. people.
  50.    You can use the `diff' command to show differences between two
  51. files, or each corresponding file in two directories.  `diff' outputs
  52. differences between files line by line in any of several formats,
  53. selectable by command line options.  This set of differences is often
  54. called a "diff" or "patch".  For files that are identical, `diff'
  55. normally produces no output; for binary (non-text) files, `diff'
  56. normally reports only that they are different.
  57.    You can use the `cmp' command to show the offsets and line numbers
  58. where two files differ.  `cmp' can also show all the characters that
  59. differ between the two files, side by side.  Another way to compare two
  60. files character by character is the Emacs command `M-x
  61. compare-windows'.  *Note Other Window: (emacs)Other Window, for more
  62. information on that command.
  63.    You can use the `diff3' command to show differences among three
  64. files.  When two people have made independent changes to a common
  65. original, `diff3' can report the differences between the original and
  66. the two changed versions, and can produce a merged file that contains
  67. both persons' changes together with warnings about conflicts.
  68.    You can use the `sdiff' command to merge two files interactively.
  69.    You can use the set of differences produced by `diff' to distribute
  70. updates to text files (such as program source code) to other people.
  71. This method is especially useful when the differences are small compared
  72. to the complete files.  Given `diff' output, you can use the `patch'
  73. program to update, or "patch", a copy of the file.  If you think of
  74. `diff' as subtracting one file from another to produce their
  75. difference, you can think of `patch' as adding the difference to one
  76. file to reproduce the other.
  77.    This manual first concentrates on making diffs, and later shows how
  78. to use diffs to update files.
  79.    GNU `diff' was written by Mike Haertel, David Hayes, Richard
  80. Stallman, Len Tower, and Paul Eggert.  Wayne Davison designed and
  81. implemented the unified output format.  The basic algorithm is described
  82. in "An O(ND) Difference Algorithm and its Variations", Eugene W. Myers,
  83. `Algorithmica' Vol. 1 No. 2, 1986, pp. 251-266; and in "A File
  84. Comparison Program", Webb Miller and Eugene W. Myers,
  85. `Software--Practice and Experience' Vol. 15 No. 11, 1985, pp. 1025-1040.
  86. The algorithm was independently discovered as described in "Algorithms
  87. for Approximate String Matching", E. Ukkonen, `Information and Control'
  88. Vol. 64, 1985, pp. 100-118.
  89.    GNU `diff3' was written by Randy Smith.  GNU `sdiff' was written by
  90. Thomas Lord.  GNU `cmp' was written by Torbjorn Granlund and David
  91. MacKenzie.
  92.    `patch' was written mainly by Larry Wall; the GNU enhancements were
  93. written mainly by Wayne Davison and David MacKenzie.  Parts of this
  94. manual are adapted from a manual page written by Larry Wall, with his
  95. permission.
  96. File: diff.info,  Node: Comparison,  Next: Output Formats,  Prev: Overview,  Up: Top
  97. What Comparison Means
  98. *********************
  99.    There are several ways to think about the differences between two
  100. files.  One way to think of the differences is as a series of lines
  101. that were deleted from, inserted in, or changed in one file to produce
  102. the other file.  `diff' compares two files line by line, finds groups of
  103. lines that differ, and reports each group of differing lines.  It can
  104. report the differing lines in several formats, which have different
  105. purposes.
  106.    GNU `diff' can show whether files are different without detailing
  107. the differences.  It also provides ways to suppress certain kinds of
  108. differences that are not important to you.  Most commonly, such
  109. differences are changes in the amount of white space between words or
  110. lines.  `diff' also provides ways to suppress differences in alphabetic
  111. case or in lines that match a regular expression that you provide.
  112. These options can accumulate; for example, you can ignore changes in
  113. both white space and alphabetic case.
  114.    Another way to think of the differences between two files is as a
  115. sequence of pairs of characters that can be either identical or
  116. different.  `cmp' reports the differences between two files character
  117. by character, instead of line by line.  As a result, it is more useful
  118. than `diff' for comparing binary files.  For text files, `cmp' is
  119. useful mainly when you want to know only whether two files are
  120. identical.
  121.    To illustrate the effect that considering changes character by
  122. character can have compared with considering them line by line, think
  123. of what happens if a single newline character is added to the beginning
  124. of a file.  If that file is then compared with an otherwise identical
  125. file that lacks the newline at the beginning, `diff' will report that a
  126. blank line has been added to the file, while `cmp' will report that
  127. almost every character of the two files differs.
  128.    `diff3' normally compares three input files line by line, finds
  129. groups of lines that differ, and reports each group of differing lines.
  130. Its output is designed to make it easy to inspect two different sets of
  131. changes to the same file.
  132. * Menu:
  133. * Hunks::        Groups of differing lines.
  134. * White Space::        Suppressing differences in white space.
  135. * Blank Lines::        Suppressing differences in blank lines.
  136. * Case Folding::    Suppressing differences in alphabetic case.
  137. * Specified Folding::    Suppressing differences that match regular expressions.
  138. * Brief::        Summarizing which files are different.
  139. * Binary::        Comparing binary files or forcing text comparisons.
  140. File: diff.info,  Node: Hunks,  Next: White Space,  Up: Compa