Array
University of Oregon

Git 101

Skip the install instructions on pp. 7-8 of our textbook.

Run the installer even if you have previously installed Git. This will install the new version of Git over the existing version.

1. Install Git 

Open git-scm.com/download and run the installer for your operating system.

Mac Users:

  • If you double-click the installer, and it says you don’t have permission to run it, then right-click the installer, and choose Open.
  • You do not have to install XCode Tools. If you are prompted to install XCode Tools, see your instructor. (For more information, see XCode Not Needed.)

Windows Users: 

  • Watch 07:25 – 09:30 of this video: Git & GitHub Crash Course For Beginners.
    It shows you how to navigate all the options the installer asks you to select.
  • See The GitBash Shell for Windows, below.

2. Configure Git

Next, configure your name and email as described on p. 12 of our textbook. The following steps are also covered in this 4-min. video: Git Going with Git.

  1. Open a shell (Mac: Terminal; Windows: Gitbash),
  2. Enter these shell commands, replacing the values with your own user name and email:

    git config --global user.name 'Jille Bonfemme'
    git config --global user.email 'jilleb@jakku.edu'
    git config --global color.ui 'auto'
    git config --global core.editor="nano"

    Setting the UI color to auto causes the output of Git commands in the terminal to be color coded.

    Setting the editor to nano prevents Git from sending you to the Vim editor.

    The reason we prefix --global to the command is to avoid having to type these config commands the next time we start Git on our computer.


3. Learn Git & Github

  1. Try Git in 15 Minutes (Github). Complete this tutorial asap.
  2. Introduction to Git and Github (Open Bookshelf). Read the Preface, Getting Started, Working Locally, and Remote Repositories.
  3. Hello World (Github Guides). “10 minute read.”

4. Know these Essential Git Concepts

  • Directory: A folder on your computer used for storing multiple files.
  • Repository: A directory where Git has been initialized to start version controlling your files.
  • Untracked, Committed, Modified, and Staged: A newly-created file is not tracked by Git until you use the add command to stage the file. Once Git is tracking a file, the file can be in one of three states:

    Committed means that this version of the file is stored in your local git database.

    Modified means that you have changed the file but have not committed it to your database yet.

    Staged means that you have marked a modified file in its current version to go into your next commit snapshot.

Using Git at the command line, the basic workflow  is summarized in this image:

Git-command-line-workflow


 

The GitBash Shell for Windows

Git for Windows includes a “Gitbash” shell, which provides a Unix-like terminal experience. It has a small but useful subset of Unix commands.

While Gitbash provides you with a minimal bash shell, it’s still using the built-in Windows console application, which means even simple tasks like resizing a console window, selecting text, cutting, and pasting is not easy.

Git Bash will execute all Git commands, but it is not an actual Unix shell. Therefore commands like chmod will not run in Git Bash, since Windows file permissions are quite different from Unix.


Git & Github as a Code Portfolio & Tech Resume

Although Git is a not the most user-friendly app to learn, it’s one of the most useful for web developers. In our class, you will learn and use the basic features of Git.

As a direct benefit, the Git repos you create for this class and host on Github can be used as a Code Portfolio to demonstrate concepts and skills you learned in CIT.

GitHub is a valuable component of any CIT resume.


Git Resources

Skip to toolbar