Intro to Git

Git is an open source, distributed, version control system designed for speed and efficiency.

A git repository is two things

  • A key value store mapping checksum → file
  • A tree talking about how those checksums correspond to versions, branches, etc.

To the User..

A magic directory with lots of filesystem features.

git init

Creates a new git repository


  - project/
      + .git/
      - README
  

The git repository lives in .git

Interact with the repository with a staging process

When you commit it bumps up the "version" of your repository.

Demo

  • git init
  • git status
  • git add
  • git commit

Talking to Other Repositories

  • git remote add URL
  • git clone URL
    • automatically adds URL as "origin"
  • git push REMOTE BRANCH
  • git pull REMOTE BRANCH

Demo

  • git clone
  • git pull
  • git push

Exercise 1