Revert/Restore Deleted SVN Files

I am back!.. with a quick tip.

We recently had a situation at work where someone deleted the whole trunk of a SVN repository.

If you have accidentally deleted files on SVN, there is no need to panic, there are still there, after all what would be the point of source control if they weren’t?

Unlike Perforce or other source control solutions, SVN makes it harder to recover.

The solution we are aware of is like this:

1. Update to the revision where the files still existed.

2. Export the directories/files you want to re-add to an unversioned directory. (For Tortoise SVN users, the “Export…” command).

3. Update to HEAD, deleting the files.

4. Copy the files you exported back into the working copy and mark them for add.

5. Commit.

Done. Easy as pie? Maybe…however, very counter-intuitive.

SVN developer people, please fix this?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.