Intro to Git for scientists

Karthik Ram
@_inundata

A git repository is two things

  • A key value store maps checksum → file
  • A tree: How these checksums correspond to versions and branches.

An even simpler workflow

  1. edit files (Grab tub of ice cream)
  2. Stage the changes and commit (run to cashier and pay for it)

Master branch


Current branch

New branch

New branch

Compare the two branches

git checkout master
git branch
* master
  new_idea

cat file1.txt

My first file
Another exciting data point

git branch
git checkout new_idea
  master
* new_idea

cat file1.txt

My first file
Another exciting data point
Another new line
Added a sentence in my new branch

What a merge looks like

Other things you can do

  • Collaborate with your coauthors
  • Use various free/paid tools including guis
  • Manage everything with git
// // //