.comment-link {margin-left:.6em;}

Free Penguin

Tuesday, October 16, 2007

Using diff and patch

Using Diff and Patch tools

Creating the patch

If you want to port some changes from one source directory to another, you can use diff and patchFirst you create a file which contains the information of the changes, so called patchThis can be done with the diff tool, or if your code uses Subversion, then you can use the svn diff command:
$> svn diff > changes.patch

Applying the patch

Then you can copy this patch to another source directory where you can apply it using the patch tool:
$> patch -p0 < changes.patch
Mind the -p0 option. It indicates to interpret the directory structure just like the one where the patch was generated.

Undo

If you test the patch and you decide you want to remove it, then you can do it from the same directory where you applied it with:
$> patch -R -p0 < changes.patch

More information

0 Comments:

Post a Comment

<< Home