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
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 />
Git recognized the changes to test.txt. We can now add the modified version of test.txt and commit<br />
it using git add test.txt and git commit –m "modified test.txt". After committing, use the git log<br />
command to see the history of the commits to your repository. You should see two commits for the file you<br />
committed that look similar to the following:<br />
commit d4c24ca1854e53676178141be86246b1a3cb0a1a<br />
Author: Todd Tomlinson <br />
Date: Wed Mar 19 08:27:10 2014 -0700<br />
modified test.txt<br />
commit 39b5859fa70d1aafacd5c04d7695e715fdfd6bd6<br />
Author: Todd Tomlinson <br />
Date: Wed Mar 19 08:23:04 2014 -0700<br />
committing the initial version of test.txt to the repository<br />
You’ll see in the previous listing that there are two different commit IDs. If you needed to revert<br />
test.txt to its initial state, you could do so by using the initial commit ID. The command for reverting to<br />
a previous commit is git revert . To revert my changes to test.txt, I would use the first<br />
commit ID, the one ending in bd6:<br />
git revert 39b5859fa70d1aafacd5c04d7695e715fdfd6bd6<br />
After reverting and checking my test.txt file, I can see that the file is back to its original state before<br />
I made changes to it. Whew!<br />
You now have enough basic information to set up your local Git repository and store your changes,<br />
but all your changes are stored locally on your laptop, desktop, or server, and often you may want to enable<br />
others to view and/or make changes to your repository. There are several solutions for providing access to<br />
your Git repository, including one of the more popular solutions, GitHub, which is the one I will introduce<br />
you to in this chapter.<br />
Using GitHub<br />
Using GitHub enables you to share your Git repositories with others and facilitates situations where you’re<br />
doing development on your laptop or desktop and your site resides on a remote server. In either of these<br />
scenarios, GitHub provides an environment that is accessible over the Internet, and if you’re okay with the<br />
general public having access to your repositories, the service is free. For a small monthly fee you can upgrade<br />
to a GitHub account that provides private repositories that are only accessible to those who you have granted<br />
access rights to. For demonstration purposes, we’ll use the free version of GitHub. If you do not already have<br />
an account, visit https://github.com and sign up for a new account.<br />
After setting up your account, the first step is to create a repository. On your GitHub landing page<br />
(once you’ve logged on), you’ll see one or more links and buttons to create a repository. Click one of the<br />
links and you’ll see a page similar to Figure 16-1.<br />
180