Create and apply subversion patches

tux_compIt’s very easy to create and apply patches using SVN. Find a few examples below (I have assumed that in all cases you are at the root directory of your project):

  1. Create a patch for all your local changes
    # svn diff > mychanges.patch
  2. Create a patch for specific files and directories
    # svn diff path_to_file1 path_to_file2 path_to_dir1 > mychanges.patch
  3. Create a patch for changes in some files between 2 revisions
    # svn diff -r oldversion:newversion file1 file2 > mychanges.patch
  4. Create a patch for changes in current directory between 2 revisions
    # svn diff -r oldrevision:newrevision > mychanges.patch
  5. Apply a patch
    # patch -p0 < mychanges.patch
    # patch -p0 -i ./mychanges.patch

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s