views:

268

answers:

3

duplicate: How do I roll back all or part of a commit to svn?


I've set up an account at http://www.projectlocker.com/ for one of my projects. I'm the only person working on it but I figured having version tracking would still be useful, and it's a good learning experience. I've setup the standard folder structural with /trunk/, /branches/, /tags/.

So say you are working on the trunk and realize that you really messed some stuff up but you want to go back a few revisions and continue from there. I can update to a previous revision and start to make changes, but the server will not allow me to commit unless I update from the last revision which will also bring in all the unwanted changes. So how do I both go back to a previous revision and then continue working on the trunk from there? Do I somehow merge an old revision into the latest revision?

I'm using the AnkhSVN plugin for visual studio so I'd appreciate and answer that explains how to do it in that client, but I'm sure I can figure out the actual button clicks from a more conceptual answer.

+1  A: 

From the subversion book:

http://svnbook.red-bean.com/en/1.4/svn-book.html#svn.branchmerge.commonuses.undo

It's essentially like you said... you want to merge the older version with your working directory.

+8  A: 

I do not use AnkhSVN, so I do not now exactly what clicks you need, however it is a fairly task in TortoiseSVN and in commandline:

You just has to undo all changes by applying a reverse merge . usually this is done in Tortoise by :

  • showing the log of your working copy
  • selecting the revision to which you want to reverse merge
  • press right mouse button and select "revert to this revision"
  • commit the new revision(which is exaclty the same as the previous choosen rev.)

On Commandline you should do this:

svn merge -r 120:100 http://svn.example.com/<path_to_your_repo>

This will undo all revision from 101-120 leaving you with the same as Rev 100

Peter Parker
A: 

Not sure if it answers your question but you can just create a branch based on that old revision.

With AnkhSVN the easiest way to do that is:

  • Right click on the solution
  • Subversion -> Branch Solution
  • Check if the url is the url you would like to branch (e.g. '^/trunk') (^)
  • Choose: Sepecific version and type (or browse) the version you like to use.
  • Type a log message
  • Check the 'Switch to Branch after Creation' checkbox at the bottom
  • And then OK

(^) If the url is not what you expected you should fix the solution binding url in File -> Subversion -> Change Source Control. Normally it should be the logical root of the project.

Bert Huijben