Skip to content

Instantly share code, notes, and snippets.

@laszlomiklosik
Created June 1, 2012 05:57
Show Gist options
  • Save laszlomiklosik/2849342 to your computer and use it in GitHub Desktop.
Save laszlomiklosik/2849342 to your computer and use it in GitHub Desktop.
Script to revert to specific revision in SVN
svn merge --dry-run -r:73:68 http://my.repository.com/my/project/trunk
svn merge -r:73:68 http://my.repository.com/my/project/trunk
svn commit -m "Reverted to revision 68."
# Explanation
#Step 1 will perform a dry run and show you what the merge will produce. If you want to see exactly what changes will be applied, do a diff:
#
# svn diff -r:73:68 http://my.repository.com/my/project/trunk
# Step 2 actually performs the merge (you'd do this after you're happy with the dry run). At this point, realize what is happening: Subversion is
# calculating the changes between revision 73 and revision 68 of the trunk and applying them to your working copy. For the majority of the time, you # will thus want your working copy to be a fully updated copy of the revision you are reverting from (in this example, revision 73).
# Step 3 commits the changes to the remote repository
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment