Some technical hints

Patching

Creating a patch from two versions of a file

Let's suppose you have an old version of a file, say file.txt, and a newer, stored in file.txt.updated. To create a patch named my-file.patch that, applied to file.txt, changes its content so that it is the same as the one of file.txt.updated, one can use:

diff -Naur file.txt file.txt.updated > my-file.patch

It generates in my-file.patch a text like:

--- file.txt    2005-12-14 22:50:49.000000000 +0100
+++ file.txt.updated    2005-12-14 22:51:32.000000000 +0100
@@ -1,3 +1,3 @@
 Hello world,
-OSDL is great,
+Ceylan and OSDL are great,
 That's what the wise men say.

Applying a patch to a file

Let's suppose you have an old version of a file, say in file.txt, and a patch named my-file.patch that, applied to file.txt, updates its content. One just has to enter in the same directory:

patch < my-file.patch

No need to specify any filename, since all the necessary informations are already stored in the patch file.

For more informations, use: man patch.

Please react !

If you have information more detailed or more recent than those presented in this document, if you noticed errors, neglects or points insufficiently discussed, drop us a line!




[Top]

Last update: Saturday, March 1, 2008