How We Learned To Stop Worrying And Love Version Control
March 13, 2017
Every experienced developer knows that if your version control game is on point, the office can burn down and your clients will – assuming their servers are located elsewhere of course! – hardly notice. If not, all the slick salesmen in the world can’t cover for the way your clients’ sites keep breaking in new and confusing ways.
Version control is important.
For the uninitiated, it’s basically a way of recording all of our changes to the files that make up a project and it helps to avoid so many problems I can’t even begin to list them here.
When I first started at Venture Stream our development team was experiencing some of those growing pains that other young companies know only too much about. In our particular case, a range of opinions and methodologies in the realm of version control was causing some serious headaches.
There’s the dev who isn’t used to working in a team. The dev who has no patience with writing descriptive commit messages. The dev who doesn’t know how to use Git yet and is just having to learn as they go, with mixed results. The dev who thinks their way is the only way and goes around nagging people all the time – not me if that’s what you were thinking. *cough*
Anyway. It wasn’t working very well.
Add to this the fact that in such a young company some of the very earliest projects – that we’re still responsible for maintaining – weren’t even under any kind of version control and we had a recipe for disaster brewing.
So how did we break out of the spiral of awfulness and get on the same page? Many new agencies have faced the same uphill struggle and while we’re not 100% satisfied yet (are developers ever 100% satisfied with their own solutions?) we’re already way more efficient than even 6 months ago.
The key is setting a workflow that everyone can follow with minimum friction. Behold the beauty of our new version control chart!
If you’re moving changes from right to left, for example, from your feature branch to the develop branch, you merge. If you’re moving changes from left to right, for example, someone else’s develop branch commits to your feature branch, you (usually) rebase.
At the end of each day, you push up your changes to the team repo on Bitbucket, whether that’s an incomplete feature branch or a merge commit. At the start of the day, you pull down any relevant changes. Everything is recorded, everything has a place, and you no longer spend half your day being yelled at by the aforementioned team nag.
Our dev, staging and live sites are set up thusly:
The live site obviously stays on master branch and is deployed to remotely via DeployHQ so there’s no excuse for someone to be working directly on there and muddying things up. The client staging site also stays on master branch, so the client can use it to test their own content changes and also preview new releases before they’re deployed onto live. The developer staging site on develop branch is where all of our changes come together while we build each release, and of course our individual dev sites are where we’re free to break (test) things as much as we want.
All right, so this setup doesn’t magically solve all problems and we still have a lot of old repos to reorganise, but pulling together an official team workflow is the first step on the road to smooth sailing. Yes, a road to sailing, that’s totally a thing.
A key point to note with any version control system is that it can in no way replace effective communication within the development team. Both are necessary for the team to function.
Since you’re a developer, your team are probably on Slack, so use it! Ask questions about the work going on in other branches. Let your colleagues know if you’re about to merge something of interest. If there’s some unavoidable situation that means you need to test some code on the developer staging site, give everyone else a shout so they know to keep their hands off until you’re done. This is all common sense really, but worth pointing out – ask me how I know . . .
This new workflow combined with our recent move from Magento 1 to Magento 2, which makes things much easier, means our version control future is looking much brighter. It’s always interesting to see how other teams approach the common problems we all face, so other developers, feel free to chime in in the comments!
If you like your digital agency to be a well-oiled machine with a smooth developer workflow, why not contact us today.