Skip to main content

Blog Post

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.

I have used version control for particular client projects in the past and for projects on Drupal.org, but it was never to the degree where its usage became second-nature. I’m still not ready to call myself totally fluent with Git, but I believe I have come a long way in the past 7 months. I wrote this Guide to Version Controlled Drupal Development Using Git, Bitbucket and Pantheon (PDF) to share what I've learned thus far. 

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:

  1. Setting up the Repo
  2. Adding the Site to the Repo
  3. Create the Pantheon Site
  4. Set Local Development Environment
  5. Pull in Pantheon's Upstream
  6. Add Pantheon Remote and Commit Code from Upstream
  7. Create the Develop Branch
  8. Set up Multidev
  9. Your First PR
  10. Syncing with Pantheon
  11. Deploying the PR for Test and QA
  12. Merging to Master (the other one)
  13. 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

To get started, you'll need the following:

  • A website hosted on a server with git available
  • Bitbucket account (free is fine)
  • Pantheon account (either paid or using a free “Pantheon for Agencies” account)
  • 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.  

Additional Resources 
Using "Workflow Tools" to Deploy your Content (and Code) | Blog  
Why Git-Flow for My Team?| Blog 
Git-Flow for Daily Use | Blog

Cameron Prince

Meet team member, Cameron Prince

Cameron brings a depth of Drupal experience to his role as a Senior Developer at Mediacurrent. He began building dynamic websites in the late '90s before shifting his focus to Drupal...

Learn more about Cameron >
Access icon Up arrow icon Drupal 8 icon Facebook icon - white Facebook icon - blue outline Facebook icon - yellow Hollow right arrow icon Hollow right arrow icon - white LinkedIn icon - white LinkedIn icon - hollow LinkedIn icon - blue outline LinkedIn icon - yellow Mediacurrent wordmark Quote icon Twitter icon - white Twitter icon - hollow Twitter icon - blue outline Twitter icon - yellow Youtube icon - white Youtube icon - yellow