Removing local SVN metadata

When you control the versions of your project codebase in SVN, one of the things that SVN does is keeping some files in the local working copy of the project. As explained in the wikipedia:

Subversion stores additional copies of data on the local machine, which can become an issue with very large projects or files, or if developers work on multiple branches simultaneously. These .svn directories on the client side can become corrupted by ill-advised user activity.

If, for some reason, you want to disconnect your local copy of your project from the SVN server version, in other words, you just want your project to be local and not be linked at all with a version control system, the best way to do it is through a graphic SVN client, preferably the one you used to connect it in the first place. Two graphic ways (Eclipse plugin and Tortoise SVN) of doing this and the command line one are described here:

1.- Eclipse plugin: Subversion, Subclipse. I am using Subclipse here. Just do right click on the name of the project, go to Team -> Disconnect. You will get a prompt like this:

Make sure you change it to:

Before hitting Yes.

2.- Tortoise SVN: imagine you have your project like this:

There is no direct tool through the Tortoise SVN client to do this, but your best shot is exporting your local working copy. This will recreate the project without any .svn directory or local SVN metadata. So we do right click on the project name, TortoiseSVN -> Export:

Then:

Click OK and there you go, project in dummyExported does NOT contain any .svn folder hence it’s not connected whatsover to any SVN repository from a local point of view. The original working copy is still there, so you can remove it completely and copy the exported one to the original location is this is necessary for you.

3.- Command line: as usual, there is a much quicker and cleaner way to do this with the command line (assuming you are in a Unix-like machine or you have at least a Unix-like console at your disposal, like Cygwin). It is explained quite well here, but in case you’re in a rush:

$ rm -rf `find . -type d -name .svn`

If you type that from the current directory of the project you want to disconnect, every single .svn directory on it and on its subdirectories will be erased, hence the local working copy disconnected from the SVN repository.

Leave a Reply

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