Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to undo an 'svn copy'

Tags:

undo

copy

svn

I've accidentally overwritten an old branch by copying trunk over it using 'svn copy'. More specifically, for every release, trunk is branched and kept as a tag, using:

svn copy svn://machine/REPOS/trunk svn://machine/REPOS/tags/$RELEASENR

But this time the value of 'RELEASENR' was that of an old existing branch instead of a new one. Anybody have any ideas on how to undo this mistake? Thanks already!

like image 521
vahidg Avatar asked Apr 07 '09 08:04

vahidg


People also ask

What is svn Revert command?

Reverts any local changes to a file or directory and resolves any conflicted states. svn revert will revert not only the contents of an item in your working copy, but also any property changes.

How do I Uncommit files in svn?

To undo a specific revision you can use the following command: $ svn merge -c -r3745 . In case you have other edited files in working directory, you can commit only the relevant files. Please note that undoing actually will mean you create a new revision with the negatives changes of last commit.


1 Answers

Subversion doesn't work that way. You haven't actually overwritten it. If the target of the copy or a move exists and is a directory, then the copied or moved item is placed in that directory:

svn copy svn://machine/REPOS/trunk svn://machine/REPOS/tags/EXISTS_ALREADY

If you look, you should find:

svn://machine/REPOS/tags/EXISTS_ALREADY/trunk 

Which is a copy of the trunk you just tried to tag. The fix in this case is easy:

svn mv svn://machine/REPOS/tags/EXISTS_ALREADY/trunk \
       svn://machine/REPOS/tags/CORRECT_TAG_NAME

(In case you're not *nix conversant: The \ means I've broken one logical line into two physical lines to spare your horizontal scrollbar from overwork.)

like image 188
bendin Avatar answered Oct 23 '22 18:10

bendin