Does svn have a `revert-all` command?

Eric Wilson picture Eric Wilson · Nov 15, 2011 · Viewed 124.5k times · Source

If I want to throw away all of my changes, and return to the code that is on the repository, I do the following:

$ rm -fr *
$ svn up

This is easy enough, but I'm wondering if there is a single command that will accomplish this, something like:

$ svn revert-all

Answer

Juan Carlos Muñoz picture Juan Carlos Muñoz · Nov 15, 2011

You could do:

svn revert -R .

This will not delete any new file not under version control. But you can easily write a shell script to do that like:

for file in `svn status|grep "^ *?"|sed -e 's/^ *? *//'`; do rm $file ; done