Objective

This lab will provide you with the fundamentals of the distributed version control system git.

Completion time: 30 minutes

Prerequisites

You will need a git client on your workstation. If you are a DevNet event, such as at CiscoLive!, the workstations are pre-installed with git, and you must open the git shell. Find the icon on the taskbar that looks like:

For windows users there are two ways to interact with git on the command prompt:

  • 'git bash' is a UNIX style command prompt allowing you to interact with the windows file system
  • 'git cmd' is a windows style command prompt allowing you to interact with the windows files system. Throughout the tutorial we assume that you're either working on a UNIX system or using 'git bash' on Windows

What is version control vs. distributed version control?

Unlike version control systems like subversion, git is a distributed version control system. What this means is that git is really great for sharing code with many individuals, and still being able to keep your changes in-sync, properly versioned, with a complete replica of the commits and repo content.

Note: GitHub is not the same as git. GitHub is a company and a service that has popularized the git protocol, and provides a centralized community for discovering code.

As a small bit of trivia, git was largely created by Linus Torvalds -- the founder of the Linux kernel.

Getting started with git config

So that you can get credit (or blame) for the work that you've contributed, you need to associate your name and email address with your work. To do that in git, you use the git config command.

git config --global user.name "Your Name Comes Here"
git config --global user.email you@yourdomain.example.com

Now you're all set to start contributing your code!


© 2015 Cisco Systems, Inc.
This work is licensed under a Creative Commons Attribution 4.0 International License.