Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to revert checkout of svn repo?

I accidentally checked out huge codebase in my user folder, and it will be really pain to delete everything out manually, is there a way to remove it?

I'm talking about removing working copy...

share|improve this question
What OS are you using? Can't you just delete the N newest files? – terdon Apr 17 '13 at 18:35
@terdon I'm on mac. – Sandro Dzneladze Apr 19 '13 at 15:51
up vote 1 down vote accepted

svn ls will show you the versioned files and folders in the current working directory.

To automate removal of versioned files, you can run the following:

svn update --set-depth empty

This will set the working copy depth to empty, meaning that all future update operations will not checkout anything. This also causes all already versioned files not in the given depth (i.e. all of them) to be deleted locally.

share|improve this answer
This is an awesome trick, sorry it took me so long to accept your answer :) – Sandro Dzneladze Jun 22 '13 at 20:45

I am not very familiar with svn so I am not sure if checked out files keep their original timestamp. Assuming they do not, the checked out files will all have been created at the same time on your system. You should then be able to remove them either by sorting by date on finder or from the command line with find.

If you want to delete all files and folders created less than 24 hours ago:

find . -mtime -1 -delete

You can also use -mmin for minutes. Have a look at man find and here for more information.

If the situation is more complex and simple timestamps will not do, you can try checking out the files into another directory, listing the files created and then deleting files with the same name from the original directory.

mkdir newdir; cd new dir
svn co
for n in $(find . ); do rm "/old_dir/$n"; done

This will list all files checked out (find .) and delete them sequentially.

share|improve this answer
The first approach does not work if SVN's use-commit-times = yes is set. – Daniel Beck Apr 20 '13 at 13:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.