Terminology [Git terms]

  • Version Control System / Source Code Manager: A version control system (abbreviated as VCS) is a tool that manages different versions of source code. A source code manager (abbreviated as SCM) is another name for a version control system.
  • Commit: Every time you commit (save the state of your project in Git), it basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot. You can think of it as a save point in a game - it saves your project’s files and any information about them.
  • Repository / repo: A repository is a directory which contains your project work, as well as a few files (hidden by default on Mac OS X) which are used to communicate with Git.

  • Working Directory: The Working Directory is the files that you see in your computer’s file system. When you open your project files up on a code editor, you’re working with files in the Working Directory.

  • Checkout: A checkout is when content in the repository has been copied to the Working Directory.

  • SHA: It is a 40-character string composed of characters (0–9 and a–f) and calculated based on the contents of a file or directory structure in Git. “SHA” is shorthand for “Secure Hash Algorithm”.

  • Branch: A branch is when a new line of development is created that diverges from the main line of development. This alternative line of development can continue without altering the main line.

Configuring Mac’s Terminal

We’re about to configure the Terminal to display helpful information when in a directory that’s under version control. This is an optional step! You do not need to re-configure your terminal for Git to work. You can complete the entire course without reconfiguring it. However, reconfiguring the Terminal makes it significantly easier to use.

If you choose to configure your Terminal, here’s what it should look like when you’re finished.
configured display

Configuration Steps

To configure the terminal, we’ll perform the following steps:

  1. download the zipped file
  2. move the directory udacity-terminal-config to your home directory and name it .udacity-terminal-config (there’s a dot at the front, now!)
  3. move the bash_profile file to your home directory and name it .bash_profile (there’s a dot at the front, now!)
    if you already have a .bash_profile file in your home directory, transfer the content from the downloaded bash_profile to your existing .bash_profile

Download the zipped file to get started.

First Time Git Configuration

Before you can start using Git, you need to configure it. Run each of the following lines on the command line to make sure everything is set up.

# sets up Git with your name
git config --global user.name "<Your-Full-Name>"

# sets up Git with your email
git config --global user.email "<your-email-address>"

# makes sure that Git output is colored
git config --global color.ui auto

# displays the original state in a conflict
git config --global merge.conflictstyle diff3

git config --list

Git & Code Editor

The last step of configuration is to get Git working with your code editor. Below are three of the most popular code editors. If you use a different editor, then do a quick search on Google for “associate X text editor with Git” (replace the X with the name of your code editor).

  • Atom Editor Setup

    git config --global core.editor "atom --wait"
  • Sublime Text Setup

    git config --global core.editor "'/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl' -n -w"
  • VSCode Setup

    git config --global core.editor "code --wait"