Sat, 25 Nov 2006

patch and diff

To create a patch against the most current development version when using SVN:

    svn diff > /path/to/patchfile.diff

For an individual file within SVN:

    svn diff changedfilename > /path/to/patchfile.diff

To create a patch when you are not using SVN:

    diff -Naur oldfile newfile > /path/to/patchfile.diff

    Note also the option -x to exclude files ... for example

        -x '*.po'     can be added to exclude all .po files

To apply a patch:

    patch --verbose [-p0] < /path/to/patchfile.diff

    where -p0 represents how much of the leading path will be dropped off
        -p0 = nothing is removed from the path
        -p1 = the leading '/' will be removed => path/to/patchfile.diff
        -p2 => to/patchfile.diff
        -p3 => patchfile.diff

More info can be found in the patch and diff man pages.  Note that there is a
section at the botton of the patch man that specifically discusses patch
creation.

Posted at: 07:53 | category: /dev | Comments ()