How to correctly rollback your changes on svn

There are days that are crazy and for a reason or another you need to rollback your just committed changes. When is only one file is quite easy, but when you are dealing with 5+ files, that can be a painful task.

SVN holds a extremely helpful command in those cases: svn merge

You can merge a previous version to the current one “rolling back” all the changes you have done.

Here is how it works:

svn merge –dry-run -r <current rev number or max rev number to be rolled back>:<rev number that will be rolled back to> http://url-to-svn-trunk/svn/trunk /path/to/your/local/repository

Example (Rolling back till version 89):

svn merge –dry-run -r 91:89 http://url-to-svn-trunk/svn/trunk /path/to/your/local/repository

Check the output from the dry run. If all is ok, just run the same command without the –dry-run option.

If you don’t know the url-to-svn-trunk, the best place to get it is to go to your local repository and run a svn info on it. It will show the current rev number, url to svn trunk, and a bunch of more info that you might find useful.

Advertisements

About mcloide

Making things simpler, just check: http://www.mcloide.com View all posts by mcloide

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

%d bloggers like this: