This lesson is being piloted (Beta version)

Introduction to git

Key Points

Motivation
  • Version control is like an unlimited ‘undo’.

  • Version control also allows many people to work in parallel.

In-browser session
  • GitHub is a service that uses git and provides functionality to collaborate with other people

  • We can browse the history of the contents of repositories and see who made which changes

Configuring Git
  • git configuration is all stored in ~/.gitconfig

  • The config is specific to each computer you use

Introducing Vim
  • Vim is everywhere. If you know how to edit a file, save it and exit, you can work in any computing environment

  • To enter INSERT mode, type i

  • To get back to NORMAL mode hit esc

  • To save a file, type :w in NORMAL mode

  • To quit vim, type :q in NORMAL mode

Our first repo
  • Initializing a Git repository is simple: git init

  • Commits should be used to tell a story.

  • Git uses the .git folder to store the snapshots.

Undoing things
  • Git history can be reverted without modifying it

  • Once changes are committed they are safe

  • Changes that are not committed can be deleted

Sharing repositories online
  • A repository can have one or multiple remotes

  • A remote serves as a full backup of your work.

  • git push sends local changes to the remote

  • git pull gets remote changes onto your local machine.

  • A remote allows other people to collaborate with you

Collaborating through GitHub
  • git clone makes a local copy of a remote repository

  • Sharing a remote allows colleagues to collaboratively work on the same files

  • Conflicts happen when two different versions of a file can’t be automatically merged

  • Conflicts need to manually resolved and the changes committed