Working with Git and GitHub

Bullet-Proof Your Workflow

Created by Steven Bitner, PhD

What is Git?

It's not GitHub

It's just a program running on your machine

  • Creates hidden files under a directory called .git
  • Tracks status of your directory whenever you tell it to

Distributed Version Control System

  • Distributed, each clone of a repository can make changes directly, without an internet connection.
  • Version control
    • project2_v1.txt
    • project2_v2.txt
    • project2_final.txt
    • project2_final_v2.txt
    • project2_group_final.txt
    • project2_submitted.txt
    • project2_for_real_final_to submit.txt
    • project2_for_real_final_to submit_v2.txt

Going shopping

Present working directory - pwd

git add

git commit

git push

git pull

Git failed to push refs error message

What is GitHub

A cloud server cluster for collaborating

...and a bit more - pull requests, issue tracking etc.


First time user?

Global configs or GitHub will git angry

  • git config --global "Your Name"
  • git config --global ""

Initializing a repo

  • Ideally through cloning
    git clone
  • git init
    • Has extra overhead since you'll need to connect to a remote
    • git remote add origin

Development Cycle

A flowchart showing the standard development cycle in Git/GutHub
Meme to segue into more complicated topics

Git diff

Git Diff

Dang, it was just compiling a few minutes ago

Standard git diff showing changes made to the current repository


git config --global diff.tool vimdiff

Git diff using vimdiff


  • git remote add origin
  • git remote add myPug
  • git remote add GoogleDrive\
       /Volumes/GoogleDrive/My Drive/repos/foo.git
    • First create a "bare" repo: git init --bare foo.git



 Doc Brown shows alternate pasts int eh space time continuum


  • Broken code
  • New feature
  • Rapid rollback


  • To create a branch: git checkout -b NEW_BRANCH_NAME
  • To get back to the previous branch, use its name, or : git checkout -
  • List all branches on your system: git branch

Merging and conflicts

  • git merge BRANCH_NAME
  • git merge -
  • Git isn't perfect, sometimes it can't automatically merge, so we get conflicts
  • Error output during a merge conflict


Work-along is at

GitHub Student Upgrade

  • GitHub
  • Digital Ocean
  • AWS
  • Heroku
  • Stripe
  • Travis CI
  • A bunch more