====== Diff and patch Usage == ===== Genral diff usage == Compare differences between 2 text files | -y | side by side compare; "%%|%%" indicates differences | | -s | Report when two files are the same | | -r | Recursively compare any subdirectories found | | -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. ===== Create a patch file == Initital situation: You have the source tree of the original project and your improved version of the project: . |-- project.org/ `-- project.new/ Create the patch file with: diff -Naur project.org project.new > improvement.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 ===== Apply the patch file == Initital situation: You have the source tree of the project to be patched and the patch file: . |-- project.toBePatched/ `-- improvement.patch Patch the project with: cd project.toBePatched patch -p1 < ../improvement.patch You can test also try out first what the patch actually would do withou changing anything: patch -p1 --dry-run < ../improvement.patch More info at http://www.kegel.com/academy/opensource.html#patches