Refer to the following two questions and answers:
Http://stackoverflow.com/questions/8139605/does-svn-have-a-revert-all-command
-----------------------------------
Could do:
SVN revert-r.
This is not the delete any new file under version control. But you can easily write a shell script to do the like:
For file in ' svn status|grep ' ^ *? ' | Sed-e ' s/^ *? *//'`; Do RM-RF $file; Done
-----------------------------------
There is a command
SVN revert-r.
In addition
If you want to revert a whole directory of files,you can use the--depth=infinity option:
svn revert--depth=infinity
SvN revert is inherently dangerous, since its entire purpose are to throw away data-namely, your uncommitted changes. Once you ' ve reverted, Subversion provides no-you-get back those uncommitted changes
-----------------------------------
Http://stackoverflow.com/questions/1239998/how-can-i-remove-all-my-changes-in-my-svn-working-directory
-----------------------------------
Used a combination of other peoples answers to come up with this solution revert normal local svn changes
SVN revert-r.
Remove any 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
-----------------------------------
None of the answers here were quite what I wanted. Here's what I came to with:
# recursively revert any locally-changed files
svn revert-r.
# Delete any other files in the sandbox (including ignored files),
# Being careful to handle files with spaces in the Name
SVN status--no-ignore | grep ' ^\? ' | \
perl-ne ' print ' $1\n ' if $_ =~/^\s+\s+ (. *) $/' | \
tr ' \ n ' | xargs-0 RM-RF
Tested on Linux; Cygwin, but relies on (I believe) a gnu-specific extension which allows Xargs to split based on ' instead ' whitespace.
The advantage to the above command is, it does not require any network activity to reset the sandbox. You get exactly the had before, and youlose all your changes. (Disclaimer before someone blames me for this code destroying their work);-)
I use the This script in a continuous integration system where I want to make sure a clean build was performed after running so Me tests.
Edit: I ' m not sure the this works with all versions of Subversion. It's not clear if the THESVN status command is always formatted consistently. Use for your own risk, as with any command that uses such a BLANKETRM command.
-----------------------------------
SVN status | grep ' ^m ' | Sed-e ' s/^.//' | Xargs RM
SVN update
Would remove any file which have been modified. I seem to remember had trouble with revert when files and directories could have been added.
-----------------------------------
-----------------------------------
Transferred from: http://alanland.iteye.com/blog/2064240