18.11.2015 Views

Beginning Drupal 8

Todd Tomlinson - Beginning Drupal 8 (The Expert's Voice in Drupal) - 2015

Todd Tomlinson - Beginning Drupal 8 (The Expert's Voice in Drupal) - 2015

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 16 ■ Using Git<br />

would clone the GitHub repository into a directory named drupal8. After cloning I could then use, modify,<br />

add to the repository, and optionally commit those changes back to the GitHub repository. There is a great<br />

deal of documentation on how to manage a multideveloper Git repository on the Git website, including<br />

topics such as creating separate branches where developers may work on changes that are then merged back<br />

into the master branch when they are ready to do so.<br />

Using Git on <strong>Drupal</strong>.org<br />

You can also use Git to clone <strong>Drupal</strong> itself or modules and themes. While Drush (see Chapter 15)<br />

makes downloading and updating modules and themes simple, there may be times when you want to<br />

contribute changes back to <strong>Drupal</strong> core or a contributed module or theme. To do so requires that you<br />

use Git and contribute your changes back to <strong>Drupal</strong>.org, a module’s repository, or a theme’s repository.<br />

Following the steps outlined previously in this chapter for creating a clone of a remote repository, visit<br />

www.drupal.org/project/drupal and click the “Version control” link near the top of the page. On the<br />

resulting page you will see instructions for how to clone the repository. That same “Version control” link<br />

appears at the top of each module’s or theme’s landing page on <strong>Drupal</strong>.org. You may also clone a module’s<br />

or theme’s repository following the same steps as previously outlined. For guidelines on how to contribute<br />

code to the community, visit www.drupal.org/contribute/development.<br />

Summary<br />

The first time you’re able to revert a file to a previous state will be the day that you fall on your knees and<br />

praise those who have created source code control systems like Git. While it’s possible to restore files from<br />

backups, the reality is that with a few simple keystrokes, you can roll back a file or your entire site to a<br />

previous state with relative ease. The second time that you will praise the Git creators is when you have a<br />

situation where you have multiple developers working on your site and they all need to jointly contribute<br />

code to the project. Spending a few minutes to learn the basics of Git will save you a lifetime of headaches,<br />

heartaches, and the occasional all-nighter as you try to restore a site back to a previous state from spotty<br />

backups.<br />

183

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!