The latest revisions in my code repo has been corrupted and has destabilized my app. I want to revert to an earlier revision. But I don't want to simply use 'revert' on my working copy; I actually want to delete my head revision and several revisions prior in my repo, thereby 'reverting' my repo to an earlier revision, which would become the head revision. Anyone know how I would do this?

link|improve this question
1  
You can't really delete old revisions, all you can do is reverse the changes, and commit that, as mentioned by Felix. Interesting sidenote, Git (as well as other version control solutions) actually does allow you to truly delete revisions.. – davr Jan 13 '10 at 20:51
Yes you can, you just need access to the SVN repository with svnadmin. See my answer below. – martin Jul 26 '11 at 7:45
davr is technically right. What you describe is dumping all revisions except the bad ones, then dumping this on top of the old repo. In my mind that's not really the same thing as 'deleting' a revision. – Sirex Jul 26 '11 at 9:42
feedback

3 Answers

up vote 5 down vote accepted

Maybe this link helps you:

http://www.sampablokuper.com/2009/03/27/svn-revert-to-revision/

Quote:

  1. Change to the top directory within your working copy (assuming you want to roll back the whole of the working copy).

  2. run svn revert to revert your working copy's files to the state they were in when you last committed/checked out.

  3. run svn status -v to see which revision number your working copy now corresponds to (it's the highest revision number in the list that svn status -v produces).

  4. run svn merge -rXX:YY where XX is the number you obtained in the previous step and YY is the number of the revision you want to revert to.

  5. Done! The possible exception to this is that files in your working copy that didn't exist when revision YY was originally made, will still be there, because by default svn doesn't remove things. If you want to get rid of them, run a svn del [filename] on each of them.

  6. Well done! Now play with your working copy as though all those intermediate edits had never happened . And when you're ready to commit your efforts, just use svn commit as usual!

link|improve this answer
In Windows Os, option #4 run svn merge -rXX:YY . Remember to put a dot at the end of line to reference the current directory. And in TortoiseSVN, there is an option to reverse merge. – Shantha Kumara Mar 1 at 8:15
feedback

You can use dump / load for this purpose.

You could also use svnsync to make a backup to some revision.

If you have a big repository, it take time.

link|improve this answer
feedback

This worked for me. Given that you have revision 1234 as the HEAD and you want to revert last three commits:

svnadmin create newrepo
svnadmin dump -r 0:1231 repo | svnadmin load newrepo
mv repo oldrepo
mv newrepo repo
link|improve this answer
feedback

Your Answer

 
or
required, but never shown