Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
becki:linux:diff_patch_tips [2010-02-15 16:25] becki created |
becki:linux:diff_patch_tips [2013-02-18 12:10] (aktuell) becki |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Diff and patch Usage == | ====== Diff and patch Usage == | ||
- | ===== Diff usage == | + | ===== Genral diff usage == |
Compare differences between 2 text files | Compare differences between 2 text files | ||
Zeile 8: | Zeile 8: | ||
| -r | Recursively compare any subdirectories found | | | -r | Recursively compare any subdirectories found | | ||
| -w | Ignore changes in white space | | | -w | Ignore changes in white space | | ||
+ | | -N | treat absent files as empty | | ||
+ | | -a | treat all files as text | | ||
+ | | -u | output NUM (default 3) lines of unified context | | ||
Use ''cmp'' for binary files. | Use ''cmp'' for binary files. | ||
Zeile 13: | Zeile 16: | ||
===== Create a patch file == | ===== Create a patch file == | ||
- | Initital situation: You have the source tree of the original project and your improved version: | + | Initital situation: You have the source tree of the original project and your improved version of the project: |
. | . | ||
Zeile 23: | Zeile 26: | ||
diff -Naur project.org project.new > improvement.patch | diff -Naur project.org project.new > improvement.patch | ||
- | If your editor has changed the amount of whitespace (eg. when it automatically deletes trailing spaces) in ''project.new/'' than you shold ignore this in the diff command in order not to confuse the receiver of the patch: | + | If your editor is set to change the amount of whitespace (which may be useful, eg. when it automatically deletes trailing spaces) in ''project.new/'' than you shold ignore this in the diff command in order not to confuse the receiver of the patch: |
diff -Naurw project.org project.new > improvement.patch | diff -Naurw project.org project.new > improvement.patch |