We would like to decrease the size of a repository by purging all binary files usually zip files that are not development oriented. Any easy way to remove them?

  • Decrease the size of the repository, or the checked out version? The latter would be fairly easy, the former could cause consistency problems. – Scott Pack Jul 29 '09 at 15:49
  • Yes I love it when someone checks in Eclipse! And yes, dump/filter/load is the way it's (un)done. – gbarry Jul 29 '09 at 16:36

i assume you wnat to decrease size of repository [ on the server ], not just content checked out.

as far as i know only way to remove something permanently from svn is to:

  1. run the dump of repository
  2. manually remove unwanted files/changes to those files from the dump
  3. recreate repository

in this way you'll preserve history and all meta-data yet you'll get rid of unwanted files [ eg binaries ].


Unfortunately, no.

There is currently no simple way to completely remove files from a SVN repository. This feature (usually called obliterate), has been requested since 2001, but it is not yet implemented. See the bug report for all the details.

The workaround for the moment is to dump the repository, filter the dump, then reimport. This is explained in the standard book, Version Control with Subversion.


The best way to prevent people checking in files you don't want is to use the pre-commit hook. Reject (ie return a non 0 value) if any of the files in the commit match a pattern. The user will receive the message when they try to commit. You can set the global-ignores, but that only applies to the client, if a client is installed without setting the ignores, they will happily attempt to checkin whatever they like.

eg. (using windows batch files, you'll be better off with perl) to restrict specific file extensions, and return the bad files with a message to the user:

@echo off

svnlook log -t "%2" "%1" | d:\tools\grep -c "[a-zA-z0-9]" > nul

echo Please enter a check-in comment 1>&2
exit 1

svnlook changed -t %2 %1 > c:\temp\pre-commit.txt

rem ** remember to set the TruncatedExtensions registry setting to 0 ** 
rem ** or .resx will be matched as if it was .res **

findstr /G:"%1\hooks\ignore-matches.txt"  c:\temp\pre-commit.txt > c:\temp\precommit-bad.txt
if %ERRORLEVEL% NEQ 0 exit /b 0

echo disallowed file extension >> c:\temp\precommit-bad.txt
type c:\temp\precommit-bad.txt 1>&2
exit 1

Where ignore-matches.txt is:


You can also prevent users from adding binary files by ignoring them you have to edit ~/.subversion/config and look for global-ignores. If the line is commented, remove the pound character.

global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store ._* *.log *.bak 

so you can add what you want i used it to keep my repository clean from mac os temporary files.

Hope that will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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