Git Workshop

Understanding and using

version control for real work

Hi, I'm Chris

I build web apps and teach people to do the same at the Lansing Code Lab

 

lansingcodelab.com

What is Git?

A distributed version control system

What is version control?

What is distributed 

version control?

Why version control?

  • Sharing code between developers
  • Backing up code between multiple machines
  • Looking back in time
  • Tracking and analyzing changes

The Terminal

Terminal commands

  • pwd # Where am I?
  • ls  # What's in the current directory?
  • cd  # Change to a different directory

Installing Git in the terminal

WINDOWS

  1. Install Git Bash at git-scm.com/download/win

OS X

  1. Install Homebrew at brew.sh
  2. Open the Terminal app
  3. brew install git

DEBIAN-BASED LINUX (LIKE UBUNTU)

  1. Open the Terminal app
  2. sudo apt-get install git

Getting started

FROM GITHUB

  1. Create a repo on GitHub

  2. git clone https://github.com/USER/REPO.git

Getting started

FROM A LOCAL PROJECT

  1. cd path/to/my-project
  2. git init

Committing changes

  1. git add -A .
  2. git commit -m "description of changes"
  3. git push origin master

Free static web hosting!

  1. git push origin master:gh-pages
  2. Visit USER.github.io/REPO

Contributing to

open source

  1. Fork
  2. Clone
  3. Push
  4. Pull Request

Collaboration with Git

  • Conflicts
  • Merge vs Rebase

More resources

  • slides.com/chrisfritz/lcc-git-intro
  • try.github.io
  • onlywei.github.io/explain-git-with-d3

Questions?

Made with Slides.com