0

How can I delete all files that are being ignored within a Subversion checkout? Effectively to bring it back to the equivalent of a pristine checkout.

1
  • What platform are you on? In Linux, there may be some crazy way of comparing a svn output and a ls output and delete those files that don't overlap or something. In Windows, if you can use TortoiseSVN, you may be able to work in the GUI with the "ignored" icons - which is not 100% reliable though
    – Pekka
    Commented Aug 24, 2010 at 9:35

5 Answers 5

3

I use this script when I want to clean out a working copy. It removes all unknown and ignored files.

svn status --no-ignore | awk '$1=="?"||$1=="I" { print $2 }' | xargs -i rm -rf {}
0
3

If TortoiseSVN, you can Check for modifications, Show ignored files, right click and delete.

1

karoberts' solution doesn't work on Mac OS X (Snow Leopard). Neither does another command I found on a blog

I get

xargs: illegal option -- i

and

xargs: illegal option -- d

respectively.

This works on Mac (adapted from karoberts'):

svn status | awk '$1=="?"||$1=="I" { print $2 }' | xargs rm -rf
0

You may want to first reverse the ignore state of those files (ref How do I Unignore a file in TortoiseSVN? for details) and then you can delete and commit back the changes from your workspace methinks.

0

Here's another way of doing it.

svn status --no-ignore | grep "^[\?I]" | sed 's%^........%%' | xargs -d "\\n" rm -rv

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