Comparing and Merging Files
diff
,
diff3
,
sdiff
,
cmp
, and
patch
Edition 1.3, for
diff
2.5 and
patch
2.1
September 1993
by David MacKenzie, Paul Eggert, and Richard Stallman
Overview
What Comparison Means
Hunks
Suppressing Differences in Blank and Tab Spacing
Suppressing Differences in Blank Lines
Suppressing Case Differences
Suppressing Lines Matching a Regular Expression
Summarizing Which Files Differ
Binary Files and Forcing Text Comparisons
diff
Output Formats
Two Sample Input Files
Showing Differences Without Context
Detailed Description of Normal Format
An Example of Normal Format
Showing Differences in Their Context
Context Format
Detailed Description of Context Format
An Example of Context Format
An Example of Context Format with Less Context
Unified Format
Detailed Description of Unified Format
An Example of Unified Format
Showing Which Sections Differences Are in
Showing Lines That Match Regular Expressions
Showing C Function Headings
Showing Alternate File Names
Showing Differences Side by Side
Controlling Side by Side Format
An Example of Side by Side Format
Making Edit Scripts
ed
Scripts
Detailed Description of
ed
Format
Example
ed
Script
Forward
ed
Scripts
RCS Scripts
Merging Files with If-then-else
Line Group Formats
Line Formats
Detailed Description of If-then-else Format
An Example of If-then-else Format
Comparing Directories
Making
diff
Output Prettier
Preserving Tabstop Alignment
Paginating
diff
Output
diff
Performance Tradeoffs
Comparing Three Files
A Third Sample Input File
Detailed Description of
diff3
Normal Format
diff3
Hunks
An Example of
diff3
Normal Format
Merging From a Common Ancestor
Selecting Which Changes to Incorporate
Marking Conflicts
Generating the Merged Output Directly
How
diff3
Merges Incomplete Lines
Saving the Changed File
Interactive Merging with
sdiff
Specifying
diff
Options to
sdiff
Merge Commands
Merging with
patch
Selecting the
patch
Input Format
Applying Imperfect Patches
Applying Patches with Changed White Space
Applying Reversed Patches
Helping
patch
Find Inexact Matches
Removing Empty Files
Multiple Patches in a File
Messages and Questions from
patch
Tips for Making Patch Distributions
Invoking
cmp
Options to
cmp
Invoking
diff
Options to
diff
Invoking
diff3
Options to
diff3
Invoking
patch
Applying Patches in Other Directories
Backup File Names
Reject File Names
Options to
patch
Invoking
sdiff
Options to
sdiff
Incomplete Lines
Future Projects
Suggested Projects for Improving GNU
diff
and
patch
Handling Changes to the Directory Structure
Files that are Neither Directories Nor Regular Files
File Names that Contain Unusual Characters
Arbitrary Limits
Handling Files that Do Not Fit in Memory
Ignoring Certain Changes
Reporting Bugs
Concept Index