Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The reasons for using version control on your Drupal projects are several and various, and have only recently become clear to me as I’ve started working with Drush and Git. Although adding version control to your workflow can be daunting at first, the benefits far outweigh the initial annoyances. Consider this:
In a recent project, while attempting to theme complex navigation on a Drupal 7 prototype, I found myself messing things up in a bad, bad way, shortly before stakeholders were supposed to look at the site. Because we had Git installed on our server, I was able to roll back to the former, not messed-up menu and leave it there while we focused on other priorities—without having to make a frantic phone call to our developer.
When working with more than one person, especially on remote teams, version control allows you not only to figure out who made what changes to the code, it allows you to work on the same file at once without accidentally overwriting each other’s changes.
Finally, version control also ensures you have exactly the same files installed in all locations. This means that you never have to worry that your local site is on a different version of a module than your server copy.
If you don’t have a GitHub account yet, skip to Step 4: Set Up a GitHub Account for a moment and come back.
In this chapter, we’ll install Git in our local development environment, set up a local and remote repository for our d7-demo site, and learn how to work Git into our Drupal workflow.