Getting Started with Git

Unlike most Unix tools, Git is very widely documented for all levels of users. While there are probably many causes for this, not the least of them being that Git is a very sophisticated and useful tool, the rise in popularity of online Git interfaces like GitHub probably has helped.

Config

Git needs some information from you before you can start using it: your name and email.

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

A lot of people wonder if their email has to be the same as their GitHub email or their Andrew email. It doesn’t.

Sometimes different Git services (GitHub, BitBucket) need to be able to recognize the email that you use in order to identify you. If you do choose a different email for this step and you are using a site like GitHub, you may want to see this GitHub help page.

Finally, run

git config --global color.ui auto

This adds color to most of the Git commands, which makes it easier to see what’s going on.

Resources

With that in mind, we’ll be reusing tutorials and guides that other people have written to teach Git in this course. Check out the “Resources” section of the Git topic page. The resources are ordered according to increasing familiarity with Git. If you’ve never used Git before, start at the top. As you gain more understanding, work your way down the list!

At the very least, make sure you know the topics covered in the first two resources listed on the Git topic page: Try Git and Git - The Simple Guide.

Help

Apart from Googling (which is probably the most useful for Git of all the Unix tools we cover), Git has a very thorough man page system. Because the majority of git uses subcommands (git clone and git commit are examples of subcommands), to access the man pages for these subcommands you have two options:

$ git help <command>

# OR


$ man git-<command>

Both of these options open up the appropriate Git command’s man page.

Copyright © 2014, Great Practical Ideas in Computer Science.