Have you heard of Subversion? No? I’m not surprised because it’s one of those tools that for the most part developers make use of. Just what is Subversion (or SVN for short)? SVN is a tool for version control. It’s purpose is to keep track of all the versions of a given document(s) and make sure that when people are working on a document together, that they don’t overwrite each other’s code. That’s the top level, basic idea behind SVN and for the most part SVN is used by developers to manage the code associated with a project.
For example, SVN is used to manage WordPress’ code. There are contributors to the codebase and then there is an administration level (5 people) who can commit the code to the core (that is make it public). WordPress is, in fact, how I got interested in SVN. One of the easiest ways to manage your install of WordPress and keep it up to date is through SVN. The Codex has a good document on installing and updating WordPress using Subversion, which is pretty easy to understand and make sense of without needing to understand much about SVN or version control systems, but there’s a catch: to manage WordPress with SVN your host has to a) allow you command line (aka shell) access to your account and b) have/allow subversion installed. Having both of those criteria isn’t common in shared hosting systems. If you have a dedicated box, well that’s a different story.
For the sake of argument, let’s go with that you have access to a server using Subversion. One of the reasons I settled on Dreamhost for my new server home was that it offers SVN and shell access to users (I have discount codes for Dreamhost, email me and I’ll give you one). Knowing that I could finally use SVN the first thing I did was install WordPress through it. The words “wow, fast” barely cover it. For most of us a lot of the time spent setting up WordPress is the uploading of all the files. When you use SVN you are connecting right to the core WordPress servers from your server. The connection speed between them is something between lightening and Warp 9 I think. Once you hit that powerful command “svn co http://core.svn.wordpress.org/tags/2.8.6 .” the files and directories for that version just fly into your server. All that’s left for you to do is set up the MySQL DB, edit the config file, and do your usual WP install bit. Done like dinner. Updates? Yeah that’s as easy as “svn sw http://core.svn.wordpres.org/tags/2.9 (once 2.9 is released).
That was a great start, but after reading Version Control with Subversion a few times I was ready to set up my own Subversion repository, import content, and start managing thing.
You can file that process under “easier said than done”, but after a couple tries I got it working just dandy. In short order I had Subversion managing updates I was making to Thesis on this blog as well as a project I’m working on for M2O. The process became just seamless. I check out the files from the repository to my local drive and to the live site. This way while the live site is technically a “working copy” I only update it, not work on it. So I make my changes on my laptop working copy. Then commit them to the repository and on the live site just type “svn up” and the live site is updated with the new code (plus a back up if I need to rollback changes).
Very slick, very easy and much faster (with less chance of error) than FTP.
Last night when I was looking for a figure I was positive I had made, it hit me that while using DropBox is great for backups, I often forget the whole hold-down-the-option-key-to-copy thing so I find myself in the position like last night knowing that I had done figures for Chapter 3, but then why aren’t there any in my Figures folder. So last night and list morning I stepped it up a notch.
I made a Subversion repository for my new book.
So my book and all its files is on my DreamHost server (therefore also backed up by them) and I have working copies on my laptop and on DropBox.
- Additional backup of my book and all its files on DreamHost (this is in addition to Time Machine and CrashPlan)
- My working copy on my laptop is still the same, including my existing file structure
- Backing up to DropBox is a real back up. Only new, changed files are copied over and they are always copied because the files come down from DreamHost. I can’t accidentally forget to option-click and “lose” files from my laptop master copy.
- As I add files (figures, etc) I just add them into the repository with the rest of the files when I commit changes to existing files.
For my set up I’m using the Mac client SvnX which took a bit of getting used to, but I figured out. I installed Subversion on my Mac using the CollabNet binary. You need Subversion running on your local machine to use the SVN repository on your server or create your own repository.
Yes, if you’re wondering, I could have managed the book files using a local SVN repository instead of a server-based one, but I wanted the extra protection of a redundant backup in the cloud. Using a local repository would work exactly the same, except that all the files are also replicated on your machine as well (taking up more space).
Yeah, I’m pretty proud of myself. It worked so well that I’ve moved all my other important writing projects into a Subversion repository as well with the same kind of set up.
What are you waiting for? Subvert yourself!
Recent Comments