Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rolling back an svn move/rename

Tags:

svn

I absent mindedly mv a folder in my svn trunk instead of branching it. I could just mv it back, but I'm afraid I'd lose history. How is this best undone?

Edit: I should be clear that I did the move on the repository, not my working copy, so it was an automatic commit.

like image 362
pondermatic Avatar asked Nov 09 '10 00:11

pondermatic


People also ask

How do I roll back a revision in svn?

Right click on the selected revision(s), then select Context Menu → Revert changes from this revision. Or if you want to make an earlier revision the new HEAD revision, right click on the selected revision, then select Context Menu → Revert to this revision. This will discard all changes after the selected revision.

How do I undo changes in svn?

If you want to undo all changes you made in a file since the last update you need to select the file, right click to pop up the context menu and then select the command TortoiseSVN → Revert A dialog will pop up showing you the files that you've changed and can revert.

Can we revert commit in svn?

Note that the svn merge command reverts a commit in the sense of having another commit undoing your changes, but keeping your wrong commit in the history.


2 Answers

See the subversion manual about Undoing Changes in order to undo your erroneous changes.

You can use svn merge to “undo” the change in your working copy, and then commit the local modification to the repository. All you need to do is to specify a reverse difference. (You can do this by specifying --revision 303:302, or by an equivalent --change -303.)

svn merge -c -303 http://svn.example.com/repos/calc/trunk
like image 135
zellus Avatar answered Sep 21 '22 13:09

zellus


If you want to revert so it is as if the move never happened then you need to dump the whole repository up to the revision you want and then recreate the repository.

Check out here and here for details.

like image 36
radman Avatar answered Sep 19 '22 13:09

radman