Getting started with Git

Check Installation

If you aren't sure if you have git installed, open terminal (or the git shell if you're on Windows) and run

git --version

If Git is installed, you should see something like

git version 1.9.1

Note: For macOS users, if you're using the Git version that came bundled with your computer, I recommend that you update and use the version packaged in brew. It's much more up to date.

Installation Instructions

The installation instructions should be fairly straightforward.

Windows Installation

You can download the git installer from the official website. You probably want to install with the git shell, instead of adding it to your PATH.

Linux

For Debian-flavoured distributions (like Ubuntu), you can just grab the latest version in your distribution's repositories

sudo apt-get install git bash-completion


macOS

Step 1

Follow the instructions to install brew.

Step 2

Install git and bash-completion using brew

brew install git
brew install bash-completion

Configuring your Git identity

Your Git identity allows people to identify you as the author of a specific commit (via git log). You can choose to set a Git configuration globally (which will be stored in ~/.gitconfig)

git config --global user.name "Lucas Francisco Fryzek"
git config --global user.email lucas.fryzek@uwmidsun.com

replacing Lucas Francisco Fryzek with your name, and lucas.fryzek@uwmidsun.com with your email address. Or don't.

Alternatively, you can just set it up for a specific repository after cloning it.

cd project-directory/
git config user.name "Lucas Francisco Fryzek"
git config user.email lucas.fryzek@uwmidsun.com

Git Workflow

Read the Git Workflow page, and familiarize yourself with the following actions:

  • cloning a repository
  • creating a branch
  • switching branches
  • adding staging files
  • committing changes
  • pushing changes to the remote repository
  • viewing commit history
  • viewing the difference between a file and the previous revision

Note: You may choose to use a Git GUI, but it is recommended that you at least understand what is going on "underneath the hood", in case you need to fix an issue.