Difference between revisions of "Diffutils"

From Christoph's Personal Wiki
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
==Utilities==
 
==Utilities==
;[[diff]] :diff compares two files and shows the differences, line by line.
+
;[[:wikipedia:diff|diff]] : compares two files and shows the differences, line by line.
;[[cmp]] :The cmp command shows the offset and line numbers where two files differ, or cmp can show the characters that differ between the two files.
+
;[[:wikipedia:cmp (Unix)|cmp]] : shows the offset and line numbers where two files differ, or cmp can show the characters that differ between the two files.
;[[diff3]] :The diff3 command shows the differences between three files. Diff3 can be used when two people have made independent changes to a common original; diff3 can produce a merged file that contains both persons' changes and warnings about conflicts.
+
;[[:wikipedia:diff3|diff3]] : shows the differences between three files. Diff3 can be used when two people have made independent changes to a common original; diff3 can produce a merged file that contains both persons' changes and warnings about conflicts.
;[[sdiff]] :The sdiff command can be used to list diff of two files side by side or merge two files interactively.
+
;sdiff : can be used to list diff of two files side by side or merge two files interactively.
  
 
==Patchset==
 
==Patchset==
The easiest way to keep track of your patches to your code is to use <tt>diff</tt>. E.g.:
+
*The easiest way to keep track of your patches to your code is to use <tt>diff</tt>. E.g.:
 
  diff -urNP foo bar > patchset_20071228.patch
 
  diff -urNP foo bar > patchset_20071228.patch
 +
 +
*You can then commit the patchset like so:
 +
patch -p0 --dry-run < patchset_20071228.patch  # Test first, then really do it:
 +
patch -p0 < patchset_20071228.patch
 +
patch -p0 -R < patchset_20071228.patch  # Apply diff in reverse
  
 
==See also==
 
==See also==
Line 16: Line 21:
 
*[[Textutils]]
 
*[[Textutils]]
 
*[[Findutils]]
 
*[[Findutils]]
 +
*[[:wikipedia:Quilt (software)|Quilt]] &mdash; utility for managing a series of changes (i.e., [[:wikipedia:Patch (computing)|patches]]) to the source code of any computer program
 +
*[[:wikipedia:Kompare|Kompare]] (aka <code>kdiff</code>)
  
 
==External links==
 
==External links==

Latest revision as of 17:47, 9 July 2012

Diffutils are a GNU collection of diff utilities.

Utilities

diff 
compares two files and shows the differences, line by line.
cmp 
shows the offset and line numbers where two files differ, or cmp can show the characters that differ between the two files.
diff3 
shows the differences between three files. Diff3 can be used when two people have made independent changes to a common original; diff3 can produce a merged file that contains both persons' changes and warnings about conflicts.
sdiff 
can be used to list diff of two files side by side or merge two files interactively.

Patchset

  • The easiest way to keep track of your patches to your code is to use diff. E.g.:
diff -urNP foo bar > patchset_20071228.patch
  • You can then commit the patchset like so:
patch -p0 --dry-run < patchset_20071228.patch  # Test first, then really do it:
patch -p0 < patchset_20071228.patch
patch -p0 -R < patchset_20071228.patch  # Apply diff in reverse

See also

External links