Most of my clients have relatively small needs. Many of them just need a basic website; or that’s how the conversation starts, anyway. I’ve found that a particular client’s needs are about as varied as you could imagine. Often, developers end up writing custom code that doesn’t have a lot of application to other clients, but is very important to the client they wrote the code for.
Most of the time, version control isn’t used for these small clients with their small projects. This isn’t the client’s fault — version control doesn’t need to be on the radar of most non-developers, and it certainly isn’t for the less tech saavy ones. But that’s why I wanted to write this piece — to put it on your radar.
Imagine we have a client who contracted a developer to build a basic WordPress site, but with some custom functionality for which no plugin already exists. After the site is built and launched, the client and the developer part ways, and the client hires me as their new developer. The client’s first task for me is to update WordPress to the newest version. Let’s throw in a wrench: say the previous developer violated rule #1 of WordPress, and his custom code is inextricably woven in to the WordPress core. This means just running the update isn’t going to work — that will break the custom functionality.
Enter Version Control
We could trash the site and start over. But there is a better option. What I would do in this scenario is to put the existing WordPress site into a version control repository, then merge the official WordPress files in, find the customizations, remove them, and build them into a plugin instead. According to Wikipedia:
Revision control, also known as version control and source control, is the management of changes to documents, computer programs, large web sites, and other collections of information. Changes are usually identified by a number or letter code, termed the “revision number”, “revision level”, or simply “revision”. […] Revisions can be compared, restored, and with some types of files, merged.
If the client’s site had been in version control to begin with, then I would have been able to go through the previous developer’s comments, hopefully giving me some insight into why he did what he did. This would allow me to begin the process of
healing unhacking the core. Once the core is unhacked, I can update it using WordPress’ built in capability, and all will be right with the world once again.
Version control becomes even more useful if you have a static HTML site, a custom built-from-the-ground-up site, or if you have multiple people touching files.
Using and Learning SVN and Git
The two dominant version control systems are Subversion (aka SVN) and Git. GitHub has a fun, interactive tutorial for learning Git. There are also a number of tools out there to make using SVN and Git easier (normally, you interact with both via command line). On Windows, my favorites are TortoiseSVN and TortoiseGit, which are shell extensions that integrate directly into Windows Explorer. Here’s a list of clients for Windows, Mac, and Linux operating systems.
The biggest drawback to using version control is that it’s got a bit of a learning curve to it. SVN is easier to learn, but Git is probably more powerful, and your developer is more likely to be familiar with it. And if you do work with a developer, ask him or her what they use and if version control might be appropriate for your existing site or future project!