If you’re just starting out with SVN, chances are you use the “just-throw-everything-on-trunk” method which will eventually lead to some, “Who broke staging again!?!?!” moments. I was introduced to the world of SVN branching via a large code rewrite effecting… pretty much our entire codebase.
Through that experience, I realized the benefits (and the hardships) of maintaining your own branch of Trunk. One of the things I love about our culture here is that we “kill the sacred cow” meaning we don’t do things just “because we’ve always done it that way.” With that in mind, we decided to have each developer setup their own project branch instead of just committing to Trunk. The benefits have been huge. We now have a Trunk the entire team can rely on. When rolling out new code, that confidence goes a long way and avoids quite a few rabbit holes trying to determine if your code changes are the problem or if someone else is half-way through a project and their code is the culprit.
After learning things the hard way, I’ve come to really appreciate Chapter 4 of the book Version Control with Subversion. If you’re not using branches and you have more than a couple people on your team, you should be using branches. If you are using branches, this chapter is a must read. It will take about an hour or so to get through, but it will save you a lot of trouble down the road.
Unless you’re using SVN version 1.5, I recommend using a wiki page or excel file to keep track of your revision numbers. This can be really helpful as you start rolling code out to your development servers, merging with release and updating your live servers. Knowing what you’ve merged and what’s been updated on which server really saves time, especially during ongoing development while rolling out bug fixes to existing versions. Below are a couple examples using Confluence and Excel:
Take it from someone who has been there, done that, got the t-shirt… branch management can be great if you do it correctly and keep track of your revision numbers during the process.
This isn’t a perfect process, but it’s the best one we’ve come up with. If you’ve found a better way, leave a comment and start the conversation.