Developing & Deploying with Git

Even the grandest structures are built from modest blocks.

As part of updating my site at the start of the year I switched to developing and deploying with Git. I’m surprised how it’s improved my workflow, even though I’m not (yet) using it to work collaboratively.

Git, for those of you not familiar with it, is a distributed revision control system. It’s usually used for source code, but it can handle any type of file.

For a while now Espresso has been my IDE of choice, but recently I’ve been fooling around with a few others behind it’s back: TextMate, BBEdit and Sublime Text 2. Using Git has meant I don’t have to remember which files I’ve been working on and need to upload. Incidentally, Coda handles this nicely without a full on revision control system.

Previously my workflow involved developing and testing locally before pushing changes over FTP to the live server (I don’t run anything of significant complexity to warrant a staging server). As I developed I would generally work through a checklist of functionality, but not always linearly or systematically.

Developing with Git has made me focus on working on a smaller incremental features or bugs at a time. Where before I would of started working on one thing and ‘just quickly do this other thing’ now I can focus on working towards a single commit before moving on. This focus has also sped up development because I’m jumping around less and can work through changes more systematically.

Deploying changes is a breeze too. I’ve based my setup on this tutorial by Joe Maller, pushing commits to a ‘hub’ repository on my server that uses a post-update hook to pull changes into the live repository. Whilst I’m comfortable using the command line, GitBox has got a simple UI and a bunch of handy keyboard shortcuts to quickly commit and push changes.

There’s still a few things I haven’t tried yet, like merging changes from other contributors, making branches to work on new features and using git-svn to contribute to other projects such as WordPress. But I’m really happy with how it’s changed my workflow and I expect I’ll be using for all my future development.