Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN Revert Trunk, remove a revision as if it never existed?

Is it possible in the svn server to remove a revision as if it never existed?

So we have the following revisions:

1004 // Commit of some bogus code that broke the build and was just wrong
1003 // Change 1.2
1002 // Change 1.1
1001
1000 *** Initial checkin

Can we we remove the 1004 in svn and revert back to 1003 as if 1004 never existed?

Forgive my ignorance, I'm still learning how to use SVN.

like image 391
Mantisimo Avatar asked Aug 26 '11 09:08

Mantisimo


1 Answers

These accidents hapen, and it's not a problem if SVN keeps them in its history. What is important is to fix the accident. The way to do it is to revert the changes made by this commit. use the following commands:

svn merge -r [current_version]:[previous_version] [repository_url]
svn commit -m “Reverting previous commit and going back to revision [previous_version].”

If you're using TortoiseSVN, you could just show the logs, select the commit, and choose "Revert changes from this revision" in the context menu. It will change your working copy to the previous version, and you'll just have to commit.

I guess other graphical clients have the same option.

like image 135
JB Nizet Avatar answered Sep 20 '22 10:09

JB Nizet