Deleting an unwanted file or set of files completely from your Subversion repository

This is not designed to be easy to do, since Subversion is a source control repository, but it’s possible.

We had a large file added to our repository by a new guy, who will not since do such a thing again, and it’s not a big deal except that we do backups every day, and we’d rather just keep the damned thing out of the backups and out of permanent or volatile storage in general.

Here’s the general writeup of the process for dumping, filtering out unwanted files, and reloading your repository.

In our specific case:

  • You are doing this on a DOS system (which is why I’m blogging it)
  • You have required privs on the Subversion server (probably admin-level, or at least read/write privs in the filesystem)
  • Your Subversion server is running (check your Services for SVNService running)
  • Repository exists at C:\Subversion_Repos\SPS
  • You have a temp directory somewhere where you have lots of room to put your various versions of the Repository Dump (in our case, C:\Temp\Subversion_Rebuild\)
  • Our Subversion repository is called svn://localhost/sps/
  • Your offending file is at path /SPS/bad_file.txt in the repository


  1. Dump your whole repository to your temporary working area: svnadmin dump "C:\Subversion_Repos\SPS" > "C:\Temp\Subversion_Rebuild\dump_for_filter_operation"
  2. Get spammed a line per revision in your repository. (i.e. * Dumped revision 0., * Dumped revision 1., etc.)
  3. Use svndumpfilter to filter your bad file out of your dump and into a truncated dump file: type "C:\Temp\Subversion_Rebuild\dump_for_filter_operation" | svndumpfilter exclude "/SPS/bad_file.txt" > "C:\Temp\Subversion_Rebuild\filtered_dump_file" (Note: UNIX’s cat is DOS’s type)
  4. Create a new repository (if you’re feeling daring, just delete the old one, but for my money, I’d probably do a hot backup of the old one just because and archive both the recent dump and the hot backup somewhere else for safekeeping until I was sure the new filtered copy worked): svnadmin create "C:\Subversion_Repos\SPS2"
  5. Load filtered dump file into the new repository: svnadmin load "C:\Subversion_Repos\SPS2" < "C:\Temp\Subversion_Rebuild\filtered_dump_file"
  6. Get spammed by load operation
  7. Test your Subversion repository and make sure it's working

You should be done!


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.