Now that we understand what git is, and why we want to use it, we need to install it first.
If you haven't installed git yet, visit the download page and run the installer for your operating system. If you're using Cloud9, git should already be installed.
Before we continue, let's verify git is working. From the command line, run:
$ git --version
You should see something like
git version 126.96.36.199.
For the most part, we will be using the command line to interact with git repositories. There are also graphical user interface, or GUI, applications available for viewing and maintaining your repositories, which we will occasionally use to see a visual representation of the changes we have made.
The important thing to know is that a git GUI application is simply a layer between the user and git. All of the commands that the GUI issues are relayed to the underlying
git command line application. That means anything you can do using a GUI, you can also do using the git command line application.
We highly recommend first getting familiar with git from its command line interface before jumping into a GUI tool.
If you are on Windows or Linux, you can use
git-gui, which both come with the official git release package available at git-scm.com/download.
To run gitk, type
gitk in your command line or terminal. To run git-gui, type
git gui instead. These commands need to be issued from an existing git repository.
If you installed git using homebrew, you also have gitk and git-gui. Otherwise, you will need to install a different GUI. The examples that follow will be created using
gitX, which is available for free at http://gitx.frim.nl/. Unfortunately, gitX is only available for OSX users.
Note: None of the Git GUI clients mentioned above work in mac OS as of macOS 10.12 or higher. There are some other clients available; you can find them by searching Google for
git gui macOS. Note that you don't have to use a git GUI client; in fact, we recommend that you don't until you get comfortable with Git in general.