tags:

views:

113

answers:

2

Is it possible to remove a file, with all version history, from SVN? For instance if you add a file with confidential financial information simply to have it backed up, and then realise it's in a SVN sub-directory all your developers can see...

+11  A: 

Yes, but it's not easy. You must be an administrator on the server where the Subversion server is running. Then use svnadmin dump to dump the repository, and svndumpfilter to exclude the appropriate file, and then reconstitute the repository. This is a costly and expensive operation which will take a long time for large repositories.

See the Subversion FAQ for more details. A detailed example of how to do this is also given in the Subversion book.

John Feminella
A good fail-safe against this is to prevent the committing of code which would cause these sorts of problematic issues -- for instance, as a first pass, you could have a whitelist of file extensions that your pre-commit hook will check for.
John Feminella
Fail safe wouldn't have helped here. We have a documentation section, with Word Files. I created one there with the plan of the next phase - timelines, costs, everything, and committed it to take a backup :(
John
+2  A: 

As already mentioned, this is going to require dumping and filtering. However there a few gotchas here which can make it painful (i.e. if the file has moved or paths changed). I just went through a very similar process and documented it carefully here: http://www.troyhunt.com/2009/12/black-art-of-splitting-subversion.html

Troy Hunt