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.
Before we continue, let's verify git is working. From the command line, run:
$ git --version
You should see something like
git version 220.127.116.11.
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: The gitX doesn't work on macOS Sierra. There is a working alternative (a fork of the original gitX) that can be found here.