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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 16<br />

Using Git<br />

This chapter provides a basic overview of Git, a source code control system adopted by the <strong>Drupal</strong><br />

community during the creation of <strong>Drupal</strong> 7. What is a source code control system, you ask? It is any tool that<br />

enables developers to manage changes to documents, source code, and other collections of information.<br />

If you have ever made changes to a document or a piece of code and then subsequently wished that you<br />

could go back in time and undo those changes, a source code control system would have saved the day.<br />

That’s one of the key features of source code control: the ability to take a snapshot of digital assets at a given<br />

point in time and then retrieve that snapshot at a later date to restore the previous state.<br />

Other key aspects of a source code control system include the ability to distribute changes to other<br />

developers or systems, and the ability to take a single code base and create copies (or branches, the more<br />

technically correct term) of that code base so that multiple developers can work on it simultaneously<br />

without clobbering each other’s work, and then at some point in time merge all of those branches back<br />

together with the ability to resolve conflicts where two people made changes to the same elements of a<br />

digital asset (e.g., a line of code).<br />

There are several source code control systems in the market. The one selected and adopted by the<br />

<strong>Drupal</strong> community is Git. Linus Torvalds, the creator of the Linux operating system, created Git during the<br />

creation of Linux as he was looking for something that was truly open source, fast, and powerful, yet easy to<br />

use. In this chapter I’ll talk about some of the basic functions of Git that you may wish to use on your new<br />

<strong>Drupal</strong> 8 site.<br />

Installing Git<br />

The first step in using Git is to install it. But before you install it, check to see if it’s already installed by typing<br />

git at the command prompt in a terminal window and pressing Return. If you see a list of Git commands,<br />

congratulations, you already have Git installed. If you see something along the lines of “command not<br />

found,” then it’s time to install Git.<br />

Installing Git on Linux<br />

Installing Git on Linux is a simple one-step process. If you are on a Debian-based distribution like Ubuntu,<br />

the command to enter in a terminal window is apt-get install git. If you are on a non-Debian-based<br />

Linux system, then you can use yum to install Git by entering yum install git-core at the command<br />

prompt in a terminal window. After installing, type git at the command prompt and press return. You<br />

should now see a list of Git commands. If you do not, check the helpful documentation on the Git website at<br />

http://git-scm.com.<br />

177

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

Saved successfully!

Ooh no, something went wrong!