12

I'm fairly new to SVN and I've never had to revert back to a previous revision, although I can get a copy of a revision from the repository okay. I'm using TortoiseSVN and the Visual Studio SVN plugin.

I'd like to restore the trunk back to a previous revision.

How can I restore the trunk - e.g. rollback to a previous revision and make this the head?

thanks

splash
  • 13,037
  • 1
  • 44
  • 67
  • possible duplicate of [SVN - How do I change the HEAD to a previous revision](http://stackoverflow.com/questions/339727/svn-how-do-i-change-the-head-to-a-previous-revision) – nobody Oct 07 '10 at 14:40
  • I think the question is slightly different - my question asks if it's possible to delete a revision - or if reverse merging is the only way –  Oct 07 '10 at 20:59

3 Answers3

13

What you need is a so-called reverse merge:

svn merge -r HEAD:<rev_you_want_to_revert_to>

See the Tortoise SVN merge documentation for details on how to do that with Tortoise SVN. Also see the SVN book (copied link from another StackOverflow question; it's actually a FAQ).

Community
  • 1
  • 1
DarkDust
  • 90,870
  • 19
  • 190
  • 224
12

The easiest way to do that with TortoiseSVN:

  • show the log for the working copy (opens the log dialog)
  • select the revision you want to undo or the revision to which you want to go back to
  • right-click on that revision, then choose "revert item to this revision" or "revert changes from this revision".

The former of those two commands reverts the working copy to the state it was in that revision, while the latter only reverts the changes of that specific revision withour reverting later changes too.

Stefan
  • 43,293
  • 10
  • 75
  • 117
1

It's a common use for svn merge.
You need to specify a reverse difference (e.g. --revision 303:302 or by an equivalent --change -303):

 svn merge -c -303 http://svn.example.com/repos/calc/trunk
Eugene Yarmash
  • 142,882
  • 41
  • 325
  • 378