Delete Subversion revision

OK, it had to happen sooner or later … some bone-head delete the trunk folder and committed this to the central repository!! Of course this happend 10 minutes before the final build of the first public test-release …

OK, so what to do now? First of all, check out a previous revision. OK, did that. So now check everything looks fine, everything builds just fine … OK!

So how to commit that to the repository? The repository know I checked out revision 125, but the latest revision is 126. So what next?

First make a backup of the repository (well, it’s kinda broken, but you never now what could happen next!!). Then dump everything up to revision 125:

svnadmin dump -r1:125 myrepo > my.dump

then create a new repository and load the dump:

svnadmin create myrepo
svnadmin load myrepo < my.dump

This way you’ll end up with a nice and clean repository, which is up-to-date with revision 125 … and the bogus revision 126 is gone!!

This really made my day!!

9 Comments

  1. You just made my evening 😀

    I messed something up, and I just thankfull that I found this trick.

    Thank You

  2. really thanx for that s*it, Ive just broke my main repo (Ive commited many many bad files) and dont know how fix it. I try with merge but It’s dont work to me. Thanx again

  3. Good stuff indeed. I have a repo in which I wanted to take an older revision and start again from there. The only way I could find to do that without an “out of date” complaint was to dump up to the revision I was starting from (having already saved a full dump), delete the repo, create a new one, and load in the partial dump. I have not doubt there’s a better way to do this since I know almost nothing of SVN, but this got the job done quick. Thanks.

  4. This is fantastic. Exactly what I was looking for. I went through all kinds of crud trying to get a previous version and commit with the same results as you had. This was so easy it took almost no time. If I had only thought to search for this before I wasted time trying other solutions.

  5. Hi, cool. But nice to know, that this solution does not work on Powershell. In normal Windows command line works beatufiul.

    Thanks

Leave a Comment.