Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN undo delete before commit

If you delete a directory from an SVN working copy, but haven't committed yet, it's not obvious how to get it back. Google even suggests "svn undo delete before commit" as a common query when you type "svn undo d", but the search results are unhelpful.

edit: I'd like a solution that works in subversion 1.4.4

like image 922
LaC Avatar asked Oct 11 '22 09:10

LaC


People also ask

How to revert svn changes?

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.

How to revert back svn commit?

To revert a single commit: Go to: Subversion -> Integrate Directory... Show activity on this post. 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.

How to get previous revision from svn?

On the file, simply right-click => Team => Switch to another branch/tag/revision. Besides the revision field, you click select, and you'll see all the versions of that file.


2 Answers

1) do

svn revert . --recursive

2) parse output for errors like

"Failed to revert 'dir1/dir2' -- try updating instead."

3) call svn up for each of error directories:

svn up dir1/dir2
like image 159
Denis Barmenkov Avatar answered Oct 16 '22 22:10

Denis Barmenkov


svn revert deletedDirectory

Here's the documentation for the svn revert command.


EDIT

If deletedDirectory was deleted using rmdir and not svn rm, you'll need to do

svn update deletedDirectory

instead.

like image 147
Michael Hackner Avatar answered Oct 16 '22 22:10

Michael Hackner