Version Controlled Drupal Development: Git, Bitbucket & Pantheon

As a veteran web developer of nearly 20 years, one of the more difficult things I ran into when I started with Mediacurrent, a Drupal agency, was working within the constraints of a version control system. For most of my career I’ve worked directly on the servers, using subdomains and transitioning things to and from live by swapping hosts.

13 Steps to Building a version controlled development environment

In this resource guide, I will introduce you to one of Mediacurrent’s common set ups for a development environment. For this example, we’re going to take an existing Drupal 7 site that is already live and build a development environment around it in thirteen steps:

Setting up the Repo

Adding the Site to the Repo

Create the Pantheon Site

Set Local Development Environment

Pull in Pantheon's Upstream

Add Pantheon Remote and Commit Code from Upstream

Create the Develop Branch

Set up Multidev

Your First PR

Syncing with Pantheon

Deploying the PR for Test and QA

Merging to Master (the other one)

Sync the Master Branch with Bitbucket

We’ll create a Git workflow that will provide a solid development environment where developers can submit their work in the form of Pull Requests (PRs). The PRs can then be reviewed, commented upon and either rejected or approved. Work from approved PRs will then be merged with a development environment for confirmation and then deployed to a test environment for quality assurance. Once the work passes QA, it is then deployed to the live environment. If it's hosted outside of Pantheon, the codebase is updated on the remote host.

Requirements

A paid or agency account is required for the multidev feature needed to synchronize with a develop branch. (Further detail is covered in Part 7 of the guide).

Local development machine with git available

I hope this resource serves as a practical guide to version control your dev environment. In future guides, we’ll go over tagging branches for release, hot fixes and more, building upon what we’ve started here.