Remove SVN Entries without Destroying the Physical Files Tips, Tricks and Tutorials 17 FEB 2014

svn-logoOccasionally you realise that certain files have been unnecessarily added into your SVN repository, such as user uploaded photos and documents for example. Obviously this causes repo bloat and because these files aren’t core to the code base, they should best be removed from the SVN repository straight away.

However, because they are now available on the server, you can’t exactly destroy them in order to chuck them out.

Thankfully, the guys developing Subversion thought of this particular use case and as such, from version 1.5.0 and up, you now get the handy –keep-local switch to apply to a svn delete call.

The result of using this switch when calling the standard SVN delete command is the removal of the targeted files from the SVN whilst leaving those physical files safe and sound where they were – in other words only the repo metadata is updated in such a way to remove the reference to those files.

In practice:

svn delete --keep-local my_file

Very useful indeed.

Related Posts:

About Craig Lotter

South African software architect and developer at Touchwork. Husband to a cupcake baker and father to two little girls. I don't have time for myself any more.