tags:

views:

149

answers:

5

I have a number of files I wish to add to subversion. Instead of taking my time and adding each individual one, I decided to be a smart-arse and do a:

svn add *

.. which was a mistake. Is there a way I can 'unadd' everything? There's about 7 files I wanted to add... it's now highlighted an extra 500+ auto-generated files I didn't mean to add!

I haven't committed it yet so hopefully there's a way to undo this!!

A: 

You can use
svn revert -depth=infinity .

This will allso undo all local changes to you files, so use it carefully.

Davide Gualano
A: 

You can use next command:

svn revert
abatishchev
+6  A: 

Do you have any changes other than the files added? (svn status will tell you - modified files will show as M, added files as A - and svn diff will show you the details of any changes). If not, then you can just do:

svn revert *

But if you do have changes other than adds, that will remove them!

(Probably worth experimenting on a few files first :-)

psmears
I think you mean svn status, not svn diff.
Aif
@Aif: I meant to mention both, but somehow managed to merge the explanations into one. Thanks for pointing it out!
psmears
+5  A: 
svn st |grep ^A |cut -c 9- |xargs svn revert

To first verify what files will be reverted without modifying anything exclude the last command:

svn st |grep ^A |cut -c 9-

Piping commands is powerful:

  • svn st will stat everything
  • grep ^A will give only lines that start with the letter A for added.
  • cut -c 9- will get the file name from those lines.
  • xargs svn revert will run svn revert for each file name.

If you're on Windows you'll have to download the UnxUtils package or similar, but that's well worth it as it brings in a lot of powerful shell commands.

Anders Abel
+1  A: 

As long as you only have added new things, just do

svn revert *

To be safe, make a local copy of your files first.

htanata