Introduction to git

Key Points

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

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

Project directories
  • Project directories should contain a single self-contained unit of work

  • Clear and logical organisation and naming aids understanding of the project

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

Introduction to R and R Studio
  • Use RStudio to write and run R programs.

  • Set up an RStudio project for each analysis you are performing.

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.

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

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

  • ‘Cloning’ initialises a repository using content from somewhere else.

  • ‘Pushing’ sends local changes to the remote.

  • ‘Pulling’ gets remote changes onto your local machine.

  • A remote allows other people to collaborate with you.

Fixing mistakes
  • Git history can be reverted without modifying it

  • Changes that are not committed can be deleted permanently

  • Once changes are committed they are safe

  • Sometimes, you just need to burn it all down and start again

Collaborative notetaking
  • Commit and push often to have a meaningful backup of your work

  • Make your commit messages meaningful