Techmania

February 7, 2012

Creating Patches with SVN Diff

Filed under: Development,FOSS,Linux — mifan @ 12:33 am
Tags: , ,

I recently came across a situation where I had to generate a patch from SVN, where I was in a multi-developer environment, my code was committed in 2 batches, and there were changes from other developers in between. Thanks to the power of SVN, this is a breeze (of course, I’m not even going to start the version control debate here!!).
The format for SVN diff is as follows:

svn diff [-r N[:M]] [--old OLD-TGT] [--new NEW-TGT] [PATH...]

In this case, to generate a patch between revisions 1000 to 1020, only for files file1.php and file2.php would be as follows

svn diff -r 1000:1020 dir1/file1.php dir2/file2.php > mypatch.patch

For conventional patches, you would checkout the code, make your changes, and from the root locations run the svn diff, as

svn diff > mypatch.patch


About these ads

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

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

The Rubric Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: