Training Missions

Missions: Using Git

Having trouble with the mission? Read how to get help.

Setup Git

Git is a version control system (VCS) created by Linus Torvalds,  the creator of the Linux kernel. Git is known as a 'distributed” VCS, or DVCS. This means that each user's copy of the code is a fully working repository and includes all previous commit information.  Rather than connecting to a remote server as you would with Subversion or CVS, users can work productively offline, choosing to later sync their changes with a remote repository or create a patch file.

Other resources

  • The website for the git project contains a quickstart guide and links to other useful resources.
  • Try Git is a free interactive tutorial on the basics of git.
  • The Git Community Book is a wonderful resource for more in depth explanation of git's features.
  • Many git users chat on the #git channel on freenode.net IRC

The purpose of this mission is to teach you how to clone a remote repository, make changes to a file, check them into your local copy, and finally create a patch file.

Preparing for the mission: Install git

If you run Debian, Ubuntu, Fedora, and other systems with a package manager, just search for "git" or "git-core" and install it.

If you run Windows, go to git-scm.com (the git homepage), click the Windows logo, and look for the latest download labeled "Full installer for official Git for Windows." Download it and run that installer. Then you can launch git by clicking Start -> Programs -> Git and clicking "Git Bash." That will open a command prompt specially configured to run git.

If you run Mac OS, go to git-scm.com (the git homepage), click the Mac logo, and look for the latest download for your version of Mac OS. After you install it, launch the Terminal app that comes with your Mac.

No matter what operating system you use, you should be able to type git into your prompt and see a help message about git commands. Try that now.

Preparing for the mission: Configure git

When you make changes to a git repository, git also records your name and email address. During this training mission, you'll be making and sharing changes, so you'll have to configure git.

First, tell git your name. (Replace 'First Last' with your name, surrounded by quotes. Note that user.name must be left in the command as shown below.)

git config --global user.name 'First Last'

Now, tell git your email address. (Replace 'name@domain.com' with your email address, surrounded by quotes. Note that user.email must be left in the command as shown below.)

git config --global user.email 'name@domain.com'

When these commands succeed, they print nothing. (Also, if you're wondering, we pass "--global" so we configure git itself, rather than configuring one individual repository.)

Now, show us

Please log in.