Creating and Applying patch

Steps to creating the patch:

First, check out the most recent version of the code from Subversion using the ‘checkout’ command.

Make ur changes

Then, in the root the project run the following command. It will store the patch file in your home directory.

svn diff > patch1.diff

Steps to Apply the patch:

$ patch -p0 < /path/to/patch1.diff
p0 option is to remove the ’0′ prefix path element.
p1 option is to remove the ’1′ prefix path element. i.e if your patch has paths
+++ a/b/c.orig
—a/b/c
…..

patch -p0 would apply on ‘a/b/c’ on your target.
patch -p1 would apply on ‘b/c’ on your target.
patch -p2 would apply on ‘c’ on your target.


Author: Britto C

Performance Engineer

One thought on “Creating and Applying patch”

  1. >(p0 option makes sure that all files can be found correctly)

    p0 option is to remove the ‘0’ prefix path element.
    p1 option is to remove the ‘1’ prefix path element. i.e if your patch has paths
    +++ a/b/c.orig
    —a/b/c
    …..

    patch -p0 would apply on ‘a/b/c’ on your target.
    patch -p1 would apply on ‘b/c’ on your target.
    patch -p2 would apply on ‘c’ on your target.

Leave a reply to Kamesh Jayachandran Cancel reply