How do I delete a wrongly tagged directory in SVN?
Solution 1
If you want to remove the directory then use the svn rm
command:
svn rm foo/tags/YYYYMMDD
Solution 2
svn delete http://example.com/svn/tags/tag-to-delete -m "Tag no longer needed"
is the best approach. See also here.
Solution 3
Just delete the tag you dont want and create afresh with the same name or a different name. If you have tortoisesvn its as simple as deleting the directory from the repo browser. Then create a new tag.
Solution 4
I'm assuming you can't just delete and re-add the directory (perhaps because the working copy has changed), or you would have done that. So you have at least two options:
- Check out the tagged revision, delete it from the repository, and re-add it in the desired location.
- Use the
svn mv
command: http://svnbook.red-bean.com/en/1.0/re18.html
Note that creating a tag in subversion doesn't actually copy the files; it just creates directory entries that point to the files (See “Cheap Copies”: http://svnbook.red-bean.com/en/1.0/ch04s02.html), so you needn't worry about bloating your repository.
The Subversion Book (http://svnbook.red-bean.com) is an incredibly clear and complete reference. If you haven't read it yet, you'll probably find it to be a wealth of information.
Good luck!
freakwincy
Open-source aficionado, bachatero, amateur photographer, foodie.
Updated on August 05, 2022Comments
-
freakwincy over 1 year
I have a project Foo which I errantly created the wrong tag for. It should've read 'rMMDDYYYY' but I tagged it 'YYYYMMDD' instead. I realized my mistake after having commited my change. I now want to remove the YYYYMMDD folder under the tags directory and leave the rMMDDYYYY folder instead. i.e.
before: foo/ foo/trunk/ foo/branches/ foo/tags/ foo/tags/YYYYMMDD/ foo/tags/rMMDDYYYY
after: foo/ foo/trunk/ foo/branches/ foo/tags/ foo/tags/rMMDDYYYY
Any idea how I can do this please? Thanks in advance!
-
freakwincy over 14 yearsThanks Adam. Didn't realize I could just do an svn mv. That would've be the ideal solution but for the fact that the directory I'd have have moved it to already exists. Still, its good to know. Guess I need to brush up a litttle more on the Subversion Book.
-
freakwincy over 14 yearsThanks Shikar but TortoiseSVN isn't really an option for me as I'm on a Mac. I'll keep it in mind that if I when next I'm on a Windoze (sic!) machine ;)
-
Adam Liss over 14 yearsFunny, I came across a very similar problem yesterday: needed to move
https://path/to/dir
->https://path/to/my/dir
and solved it with "svn mv" to a temp dir,svn mkdir https://path/to/my
and finally a "svn mv" to the new structure. Don't know that I'd have been able to do that so quickly if I hadn't come across your question first ... so thank you! -
Oliver over 7 yearsOddly, the other approach of deleting the tag folder from the repo did not work (operation just did not seem available), but this svn delete did.