How can I remove all my changes in my SVN working directory?

I have an SVN working directory. I made some changes in that directory, and it shows in svn status. But is there any way for me to remove all my changes in there and just get everything from the trunk using the command line?


Solution 1:

svn revert -R .
svn up

This will recursively revert the current directory and everything under it and then update to the latest version.

Solution 2:

I used a combination of other peoples' answers to come up with this solution:

Revert normal local SVN changes

svn revert -R .

Remove any other change and supports removing files/folders with spaces, etc.

svn status --no-ignore | grep -E '(^\?)|(^\I)' | sed -e 's/^. *//' | sed -e 's/\(.*\)/"\1"/' | xargs rm -rf

Don't forget to get the latest files from SVN

svn update --force

Solution 3:

svn revert -R .
svn cleanup . --remove-unversioned

Solution 4:

If you have no changes, you can always be really thorough and/or lazy and do...

rm -rf *
svn update

But, no really, do not do that unless you are really sure that the nuke-from-space option is what you want!! This has the advantage of also nuking all build cruft, temporary files, and things that SVN ignores.

The more correct solution is to use the revert command:

svn revert -R .

The -R causes subversion to recurse and revert everything in and below the current working directory.