Git for research

L. Collado-Torres
2014-04-03

View this presentation

Version control

How do you version control?

  • Do nothing, hope for the best!
  • Mark them as old, new
  • Store files in a different directory
  • Append a _v1, _v2, etc to the file name
  • Add the date, for example: 2012_9_11_class.pdf
  • Use Dropbox, Google Drive, Google Docs, ShareLatex or something else to manage the files.

Why use a version control system?

  • Good organization can save a lot of time!
  • Clean directory
  • Best for collaborating with others: specially if you are working on the same file
  • Good project development practice
  • Helps share & reproduce

Git

  • It's a distributed version control system (DVCS)
  • The most used system: subversion uses git for their code!
  • Highly popular thanks to GitHub

Git basics

git init

git clone

git config

git add

git commit

git status

git log

Using git

SourceTree

Central workflow

Fork + pull request

alt text

Example: HopStat post

alt text

Branches for features

Example: derfinder

alt text

GitHub

Overview

alt text

Share code

Via a repository

  • One or more authors
  • Issues and bug tracking
  • Allows multiple branches

Via a gist

  • One author
  • Very quick: copy and paste

Both allow forking + comments

Issues and bug tracking

rMaps example

Great way to figure out how to do something with other great people!

  • 28 comments + 4 people involved

alt text

Source

A gist example

A gist example: revisions

Host your R package

devtools makes it easy to share code via GitHub (and others)

alt text

Source

Open source report card

How to get started

Where to host?

  • GitHub offers 5 private repos to .edu accounts
  • Bitbucket offers unlimited private repos to .edu accounts
  • Can use GitHub login info for Bitbucket (including ssh keys)

Code for this presentation