joshbuhler.com

svn export - learn it. use it. love it.

by Josh on Nov.09, 2005, under Development, Web

Recently I’ve been doing some clean up of old files and other assorted junk on one of our servers at work. Between figuring out what needs to stay online, what needs to be archived, and what can be trashed, I noticed that several folders were much larger in filesize than they needed to be. Also, it was taking forever to delete folders because they had hundreds of unnecessary files in them. The files in question? Subversion .svn folders.

Subversion (SVN) is a beautiful thing. I love it, and use it daily to manage my projects, both at work and at home. However, to assist in saving your life at times, SVN uses a system of storing information about the files it’s managing in folders labeled “.svn”. Normally, these are hidden files, so most people don’t even notice that they’re there. However, they are there, and if you attempt to copy a folder that’s under SVN version control, you’ll be copying the associated .svn files with it. Not necessarily a bad thing, unless you want to copy that folder to a webserver, or zip it and email some files off to a client.

Those .svn files can sometimes add up to a significant amount of diskspace, and you don’t need to include them. This is where svn export comes in.

Many SVN users are aware of this command, however, judging by the amount of folders I’ve deleted from our servers today that contained .svn info, and zip files I’ve received in the past from clients and other developers I’ve worked with, there are still plenty of SVN users who apparently have never heard of it.

Name
svn export — Export a clean directory tree.

As the description above states, the command svn export exports a clean directory tree from a repository or the local working copy. What this means is that the files you need are exported to a new directory to be uploaded or copied to disk, without including the extra .svn files. Saving you diskspace, and clients calling you back asking “What’s this .svn stuff? Do I need this too?”

It’s not a hard command to learn, or to use. I can’t vouch for Windows users, but if you’re using svnX on a Mac, there’s a button in the Repository window to take care of the export for you. I’m sure that the Windows SVN tools allow you to use it as well. Either way, both platforms can use the command line, and that can be even faster at times.

So, to sum up: svn export - Learn it. Use it. Love it.

Resources:



7 comments for this entry:
  1. ericd

    Right-click on Windows (…Export)

    Funny thing I did that just today for a delivery. Timely posting.

  2. Andy

    It wasn’t me Josh. I SWEAR! It was the interns!

  3. leland

    I had this same issue a while back and had to go through and clean up quite a bit of nastyness…have you tried TortoiseSVN? It’s a great windows gui and makes life with SVN so much easier. I can’t stand the command line…I’m a sissy like that.

  4. Training Guy

    Anyone know a way to export directly to a zip or jar file using tortoiseSVN or other windows tool?
    At the moment I keep a local copy just to post it to a non-svn location

  5. one guy

    The export will also keep them from checking in again. You might want this restriction from your webserver (for the day it gets hacked)

  6. tim

    switch to git

  7. zebrahest

    Great! This was exactly what I needed! :)

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...