Version Control via Git and Github

Overview

Teaching: 30 min
Exercises: 10 min
Questions
  • How do you record the history of your projects?

  • What is version control?

Objectives
  • Present overview of version control.

Prerequisites

Installation of git:

  • On mac and Linux git comes installed.
  • On Windows PC, install git for Windows
  • Create GitHub account

Recording the history of your projects

What is version control?

Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.

Question?

How do you record the history of your projects?

Bad - Run on file names

PhD Comics

Good - Informatively named files

   2013-10-14_manuscriptFish.doc
   2013-10-30_manuscriptFish.doc
   2013-11-05_manusctiptFish_intitialRyanEdits.doc
   2013-11-10_manuscriptFish.doc
   2013-11-11_manuscriptFish.doc
   2013-11-15_manuscriptFish.doc
   2013-11-30_manuscriptFish.doc
   2013-12-01_manuscriptFish.doc
   2013-12-02_manuscriptFish_PNASsubmitted.doc
   2014-01-03_manuscriptFish_PLOSsubmitted.doc
   2014-02-15_manuscriptFish_PLOSrevision.doc
   2014-03-14_manuscriptFish_PLOSpublished.doc

Better - Saving everything together at once

Everytime you make a save, you zip the entire directory that your project files are in and save it with a date.

Best - Version Control

Code for RNeXML R package, plus RNeXML publication in RMarkdown

How does a version control system work?

Software Carpentry

Software Carpentry

Why use Git and GitHub

Why use Git?

Features of using a Hosting Service Like GitHub

Example

Code for RNeXML R package, plus RNeXML publication in RMarkdown

Key Points

  • Version control is an integral part of reproducible research

  • Manipulate data in a reproducible manner