1 of 42

bioinformatics.ca

bioinformaticsdotca.github.io

2 of 42

Canadian Bioinformatics Workshops | bioinformatics.ca

3 of 42

Module 2: Version Control with Git

Mitchell Shiell & Linda Xiang

Reproducible Research: Essentials for Managing Your Data

May 27, 2026

Canadian Bioinformatics Workshops | bioinformatics.ca

4 of 42

LECTURE · 20 MINUTES

What will be covered

01

Intro to version control

02

The Core Git Workflow

03

Collaboration using Git & Github

Followed by 40 minutes of hands-on lab

Canadian Bioinformatics Workshops | bioinformatics.ca

5 of 42

01

Introduction to version control

Working better together.

Canadian Bioinformatics Workshops | bioinformatics.ca

6 of 42

01 · WHY VERSION CONTROL

04

Common concerns

Which one is current?

What changed between them?

Who edited what, and why?

Version control answers all three, automatically, on every save.

1

2

3

📄

v2

Tue

Rough Draft

v3

Wed

Added Background

v4

Thu

Cleaned up References

v5

Fri

Inputted Discussion

LATEST

📄

📄

📄

Diff

10 lines added

5 lines removed

cdse44

cew32e

Canadian Bioinformatics Workshops | bioinformatics.ca

7 of 42

01 · WHY VERSION CONTROL

Good version control, tracking files

📄

v2

Tue

Rough Draft

v3

Wed

Added Background

v4

Thu

Cleaned up References

v5

Fri

Inputted Discussion

LATEST

📄

📄

📄

Diff

10 lines added

5 lines removed

cdse44

cew32e

Which one is current?

What changed between them?

Who edited what, and why?

Version control answers all three, automatically, on every save.

1

2

3

v1

Mon · 9:14

started the project

v2

Tue · 11:02

Added Analysis Code

v3

Wed · 16:48

Edited Analysis code

v4

Thu · 10:31

Updated sample data

v5

Fri · 14:05

LATEST

Ran Analysis added output

📄 readme.md

📄 data/samples.tsv

📄 readme.md

📄 data/samples.tsv

+ 📄 analysis/qc.R

📄 readme.md

📄 data/samples.tsv

~ 📄 analysis/qc.R

📄 readme.md

- 📄 data/samples.tsv

+ 📄 data/raw-data.tsv

📄 analysis/qc.R

📄 readme.md

📄 data/raw-data.tsv

📄 analysis/qc.

+ 📄 results/qcResult1.txt

Canadian Bioinformatics Workshops | bioinformatics.ca

8 of 42

01 · WHY VERSION CONTROL

Good version control, tracking folders

Git

2005 · what we use

OUR PICK

v1

Mon · 9:14

started the project

v2

Tue · 11:02

Added Analysis Code

v3

Wed · 16:48

Edited Analysis code

v4

Thu · 10:31

Updated sample data

v5

Fri · 14:05

LATEST

Ran Analysis added output

📄 readme.md

📄 data/samples.tsv

📄 readme.md

📄 data/samples.tsv

+ 📄 analysis/qc.R

📄 readme.md

📄 data/samples.tsv

~ 📄 analysis/qc.R

📄 readme.md

- 📄 data/samples.tsv

+ 📄 data/raw-data.tsv

📄 analysis/qc.R

📄 readme.md

📄 data/raw-data.tsv

📄 analysis/qc.

+ 📄 results/qcResult1.txt

📄

v2

Tue

Rough Draft

v3

Wed

Added Background

v4

Thu

Cleaned up References

v5

Fri

Inputted Discussion

LATEST

📄

📄

📄

Diff

10 lines added

5 lines removed

cdse44

cew32e

Canadian Bioinformatics Workshops | bioinformatics.ca

9 of 42

01 · WHY VERSION CONTROL

Good Version Control

v1

Mon · 9:14

started the project

v2

Tue · 11:02

Added Analysis Code

v3

Wed · 16:48

Edited Analysis code

v4

Thu · 10:31

Updated sample data

v5

Fri · 14:05

LATEST

Ran Analysis added output

📄 readme.md

📄 data/samples.tsv

📄 readme.md

📄 data/samples.tsv

+ 📄 analysis/qc.R

📄 readme.md

📄 data/samples.tsv

~ 📄 analysis/qc.R

📄 readme.md

- 📄 data/samples.tsv

+ 📄 data/raw-data.tsv

📄 analysis/qc.R

📄 readme.md

📄 data/raw-data.tsv

📄 analysis/qc.

+ 📄 results/qcResult1.txt

📄

v2

Tue

Rough Draft

v3

Wed

Added Background

v4

Thu

Cleaned up References

v5

Fri

Inputted Discussion

LATEST

📄

📄

📄

Diff

10 lines added

5 lines removed

cdse44

cew32e

Git

2005 · what we use

OUR PICK

Canadian Bioinformatics Workshops | bioinformatics.ca

10 of 42

02 · GIT & GITHUB

Of all the version control tools, we will use Git.

Dozens of systems have come and gone, Git won the last fifteen years.

HISTORICAL

SCCS

SCCS

1972

RCS

RCS

1982

CVS

CVS

1986

Visual SourceSafe

1994

CC

ClearCase

1992

BitKeeper

2000

MODERN ALTERNATIVES

Subversion

2000 · still used

Mercurial

2005

Perforce

1995 · enterprise

Fossil

2006

BRIEF HISTORY

Created by Linus Torvalds in 2005 after BitKeeper, which the Linux kernel had been using for free, revoked its free license. He wrote a replacement in two weeks. Two decades later it’s a de-facto.

Git

2005 · what we use

OUR PICK

Canadian Bioinformatics Workshops | bioinformatics.ca

11 of 42

02a

Core Git Workflow

Init, add, commit, checkout

Canadian Bioinformatics Workshops | bioinformatics.ca

12 of 42

02 · CORE GIT WORKFLOW

Setting up a git repository

08

~/projects — zsh

.git

$ cd project

.git folder

Tracks the changes to your repo.

/Project/

📄

/Project/readme.md

Example file in the root directory

📄

/Project/data/

Example folder within my tracked repo

/Project/data/samples.tsv

Canadian Bioinformatics Workshops | bioinformatics.ca

13 of 42

08

.git

.git folder

Tracks the changes to your repo.

/Project/

📄

/Project/readme.md

Example file in the root directory

~/projects — zsh

$ git init –b main

$ cd project

📄

/Project/data/

Example folder within my tracked repo

/Project/data/samples.tsv

02 · CORE GIT WORKFLOW

Setting up a git repository

Canadian Bioinformatics Workshops | bioinformatics.ca

14 of 42

~/projects — zsh

$ git init –b main

.git

$ cd project

.git folder

Tracks the changes to your repo.

/Project/

📄

/Project/readme.md

Example file in the root directory

/Project/analysis

Example folder

📄

📄

/Project/data/

Example folder within my tracked repo

/Project/data/samples.tsv

/Project/analysis/qc.R

02 · CORE GIT WORKFLOW

Setting up a git repository

Canadian Bioinformatics Workshops | bioinformatics.ca

15 of 42

Committing

.git

.git folder

Tracks the changes to your repo.

/Project/

📄

/Project/readme.md

Example file in the root directory

/Project/analysis

Example folder

📄

📄

/Project/data/

Example folder within my tracked repo

/Project/data/samples.tsv

/Project/analysis/qc.R

~/projects — zsh

$ git init –b main

$ cd project

$ git commit –m “started the project

$ git add .

02 · CORE GIT WORKFLOW

Canadian Bioinformatics Workshops | bioinformatics.ca

16 of 42

git commit

.git

.git folder

Tracks the changes to your repo.

/Project/

📄

/Project/readme.md

Example file in the root directory

/Project/analysis

Example folder

📄

📄

/Project/data/

Example folder within my tracked repo

/Project/data/samples.tsv

/Project/analysis/qc.R

02 · CORE GIT WORKFLOW

ecrce34

Mon · 9:14

Started the project

LATEST

$ git commit –m “Started the project”

Canadian Bioinformatics Workshops | bioinformatics.ca

17 of 42

git commit

02 · CORE GIT WORKFLOW

ecrce34

Mon · 9:14

Started the project

LATEST

.git

.git folder

Tracks the changes to your repo.

/Project/

📄

/Project/readme.md

Example file in the root directory

/Project/analysis

Example folder

📄

/Project/analysis/qc.R

📄

/Project/data/

Example folder within my tracked repo

/Project/data/samples.tsv

Canadian Bioinformatics Workshops | bioinformatics.ca

18 of 42

git commit

ecrce34

Mon · 9:14

Started the project

LATEST

z

$ git add .

$ git commit –m “Added Analysis Code”

.git

.git folder

Tracks the changes to your repo.

/Project/

📄

/Project/readme.md

Example file in the root directory

/Project/analysis

Example folder

📄

/Project/analysis/qc.R

📄

/Project/data/

Example folder within my tracked repo

/Project/data/samples.tsv

02 · CORE GIT WORKFLOW

Canadian Bioinformatics Workshops | bioinformatics.ca

19 of 42

git commit

~/projects — zsh

$ git init

$ cd project

ecrce34

Mon · 9:14

cdw234

Tue · 11:02

Added Analysis Code

📄 readme.md

📄 data/samples.tsv

+ 📄 analysis/qc.R

LATEST

Started the project

.git

.git folder

Tracks the changes to your repo.

/Project/

📄

/Project/readme.md

Example file in the root directory

/Project/analysis

Example folder

📄

/Project/analysis/qc.R

📄

/Project/data/

Example folder within my tracked repo

/Project/data/samples.tsv

z

$ git add .

$ git commit –m “Added Analysis Code”

02 · CORE GIT WORKFLOW

$ git checkout ercre34

Canadian Bioinformatics Workshops | bioinformatics.ca

20 of 42

git checkout

ecrce34

Mon · 9:14

cdw234

Tue · 11:02

Added Analysis Code

📄 readme.md

📄 data/samples.tsv

+ 📄 analysis/qc.R

LATEST

Started the project

$ git checkout ercre34

.git

.git folder

Tracks the changes to your repo.

/Project/

📄

/Project/readme.md

Example file in the root directory

/Project/analysis

Example folder

📄

/Project/analysis/qc.R

📄

/Project/data/

Example folder within my tracked repo

/Project/data/samples.tsv

z

$ git add .

$ git commit –m “Added Analysis Code”

02 · CORE GIT WORKFLOW

Canadian Bioinformatics Workshops | bioinformatics.ca

21 of 42

ecrce34

Mon · 9:14

cdw234

Tue · 11:02

Added Analysis Code

📄 readme.md

📄 data/samples.tsv

+ 📄 analysis/qc.R

LATEST

Started the project

.git

.git folder

Tracks the changes to your repo.

/Project/

📄

/Project/readme.md

Example file in the root directory

📄

/Project/data/

Example folder within my tracked repo

/Project/data/samples.tsv

/Project/analysis

Example folder

📄

$ git checkout ercre34

z

$ git add .

$ git commit –m “Added Analysis Code”

git checkout

$ git checkout cdw234

Canadian Bioinformatics Workshops | bioinformatics.ca

22 of 42

ecrce34

Mon · 9:14

cdw234

Tue · 11:02

Added Analysis Code

📄 readme.md

📄 data/samples.tsv

+ 📄 analysis/qc.R

LATEST

Started the project

.git

.git folder

Tracks the changes to your repo.

/Project/

📄

/Project/readme.md

Example file in the root directory

📄

/Project/data/

Example folder within my tracked repo

/Project/data/samples.tsv

/Project/analysis

Example folder

📄

$ git checkout cdw234

git checkout

$ git checkout ercre34

z

$ git add .

$ git commit –m “Added Analysis Code”

/Project/analysis/qc.R

Canadian Bioinformatics Workshops | bioinformatics.ca

23 of 42

ecrce34

Mon · 9:14

cdw234

Tue · 11:02

Added Analysis Code

📄 readme.md

📄 data/samples.tsv

+ 📄 analysis/qc.R

LATEST

Started the project

.git

.git folder

Tracks the changes to your repo.

/Project/

📄

/Project/readme.md

Example file in the root directory

/Project/analysis

Example folder

📄

/Project/analysis/qc.R

📄

/Project/data/

Example folder within my tracked repo

/Project/data/samples.tsv

$ git checkout cdw234

Git checkout

$ git checkout ercre34

z

$ git add .

$ git commit –m “Added Analysis Code”

Canadian Bioinformatics Workshops | bioinformatics.ca

24 of 42

ecrce34

Mon · 9:14

cdw234

Tue · 11:02

Added Analysis Code

📄 readme.md

📄 data/samples.tsv

+ 📄 analysis/qc.R

LATEST

Started the project

.git

.git folder

Tracks the changes to your repo.

/Project/

📄

/Project/readme.md

Example file in the root directory

/Project/analysis

Example folder

📄

/Project/analysis/qc.R

📄

/Project/data/

Example folder within my tracked repo

/Project/data/samples.tsv

$ git checkout cdw234

Git checkout

$ git checkout ercre34

z

$ git add .

$ git commit –m “Added Analysis Code”

git add, commit, add, commit, add, commit…

02 · CORE GIT WORKFLOW

Canadian Bioinformatics Workshops | bioinformatics.ca

25 of 42

.git

.git folder

Tracks the changes to your repo.

/Project/

📄

/Project/readme.md

Example file in the root directory

/Project/analysis

Example folder

📄

/Project/analysis/qc.R

📄

/Project/data/

Example folder within my tracked repo

/Project/data/samples.tsv

$ git checkout cdw234

Git checkout

$ git checkout ercre34

z

$ git add .

$ git commit –m “Added Analysis Code”

started the project

Added Analysis Code

Edited Analysis code

Updated sample data

Ran Analysis added output

📄 readme.md

📄 data/samples.tsv

+ 📄 analysis/qc.R

📄 readme.md

📄 data/samples.tsv

~ 📄 analysis/qc.R

📄 readme.md

- 📄 data/samples.tsv

+ 📄 data/raw-data.tsv

📄 analysis/qc.R

📄 readme.md

📄 data/raw-data.tsv

📄 analysis/qc.

+ 📄 results/qcResult1.txt

ecrce34

Mon · 9:14

cdw234

Tue · 11:02

wec324

Wed · 16:48

233esc

Thu · 10:31

mnur3d

Fri · 14:05

LATEST

git add, commit, add, commit, add, commit…

02 · CORE GIT WORKFLOW

Canadian Bioinformatics Workshops | bioinformatics.ca

26 of 42

.git

.git folder

Tracks the changes to your repo.

/Project/

📄

/Project/readme.md

Example file in the root directory

/Project/analysis

Example folder

📄

/Project/analysis/qc.R

📄

/Project/data/

Example folder within my tracked repo

/Project/data/samples.tsv

$ git checkout cdw234

Git checkout

$ git checkout ercre34

z

$ git add .

$ git commit –m “Added Analysis Code”

started the project

Added Analysis Code

Edited Analysis code

Updated sample data

Ran Analysis added output

📄 readme.md

📄 data/samples.tsv

+ 📄 analysis/qc.R

📄 readme.md

📄 data/samples.tsv

~ 📄 analysis/qc.R

📄 readme.md

- 📄 data/samples.tsv

+ 📄 data/raw-data.tsv

📄 analysis/qc.R

📄 readme.md

📄 data/raw-data.tsv

📄 analysis/qc.

+ 📄 results/qcResult1.txt

ecrce34

Mon · 9:14

cdw234

Tue · 11:02

wec324

Wed · 16:48

233esc

Thu · 10:31

mnur3d

Fri · 14:05

LATEST

-b?

~/projects — zsh

$ git init –b main

02 · CORE GIT WORKFLOW

Canadian Bioinformatics Workshops | bioinformatics.ca

27 of 42

.git

.git folder

Tracks the changes to your repo.

/Project/

📄

/Project/readme.md

Example file in the root directory

/Project/analysis

Example folder

📄

/Project/analysis/qc.R

📄

/Project/data/

Example folder within my tracked repo

/Project/data/samples.tsv

$ git checkout cdw234

Git checkout

$ git checkout ercre34

z

$ git add .

$ git commit –m “Added Analysis Code”

started the project

Added Analysis Code

Edited Analysis code

Updated sample data

Ran Analysis added output

📄 readme.md

📄 data/samples.tsv

+ 📄 analysis/qc.R

📄 readme.md

📄 data/samples.tsv

~ 📄 analysis/qc.R

📄 readme.md

- 📄 data/samples.tsv

+ 📄 data/raw-data.tsv

📄 analysis/qc.R

📄 readme.md

📄 data/raw-data.tsv

📄 analysis/qc.

+ 📄 results/qcResult1.txt

ecrce34

Mon · 9:14

cdw234

Tue · 11:02

wec324

Wed · 16:48

233esc

Thu · 10:31

mnur3d

Fri · 14:05

LATEST

git branch

~/projects — zsh

$ git init –b main

02 · CORE GIT WORKFLOW

We have been working off “the main branch”

Canadian Bioinformatics Workshops | bioinformatics.ca

28 of 42

02b

Core Git Workflow

Branch & merge

Canadian Bioinformatics Workshops | bioinformatics.ca

29 of 42

git branch

~/projects — zsh

$ git branch experiment-001

$ git checkout experiment-001

02 · CORE GIT WORKFLOW

ecrce34

cdw234

wec324

233esc

mnur3d

LATEST

main

Canadian Bioinformatics Workshops | bioinformatics.ca

30 of 42

git branch

Experiment-001

~/projects — zsh

$ git branch experiment-001

$ git checkout experiment-001

02 · CORE GIT WORKFLOW

ecrce34

cdw234

wec324

233esc

mnur3d

LATEST

main

Canadian Bioinformatics Workshops | bioinformatics.ca

31 of 42

git branch

Experiment-001

~/projects — zsh

$ git branch experiment-001

$ git checkout experiment-001

02 · CORE GIT WORKFLOW

ecrce34

cdw234

wec324

233esc

mnur3d

LATEST

main

Canadian Bioinformatics Workshops | bioinformatics.ca

32 of 42

Experiment-001

mnur3d

LATEST

ecrce34

cdw234

wec324

233esc

mnur3d

git merge

~/projects — zsh

$ git checkout main

$ git merge experiment-001

02 · CORE GIT WORKFLOW

main

Canadian Bioinformatics Workshops | bioinformatics.ca

33 of 42

Experiment-001

mnur3d

LATEST

ecrce34

cdw234

wec324

233esc

mnur3d

git merge

~/projects — zsh

$ git checkout main

$ git merge experiment-001

02 · CORE GIT WORKFLOW

main

Canadian Bioinformatics Workshops | bioinformatics.ca

34 of 42

03

Collaboration

Moving beyond local directories

Canadian Bioinformatics Workshops | bioinformatics.ca

35 of 42

Git is the tool. GitHub is the platform.

08

THE TOOL (LOCAL)

Git

A program that runs on your laptop and tracks changes to files in a folder.

THE PLATFORM (REMOTE)

GitHub

A website that hosts Git repositories online so teams can share and collaborate.

Owned by Microsoft

Adds pull requests, issues, CI, access control

Alternatives: GitLab, Bitbucket, same Git underneath

03 · COLLABORATION

Canadian Bioinformatics Workshops | bioinformatics.ca

36 of 42

GITHUB

Remote Repository

Working Directory

git clone https://github.com/cbw/workshop.git

Staged

Commit

Git add .

Git commit

git push

git branch

my-experiment

Canadian Bioinformatics Workshops | bioinformatics.ca

37 of 42

Remote repos + branches enable parallel work.

03 · COLLABORATION

git checkout main

git pull (update local main)

git checkout refactorQCpipeline

git merge main (merge updates)

git checkout main

git merge refactorQCpipeline

git push

Canadian Bioinformatics Workshops | bioinformatics.ca

38 of 42

Remote repos + branches enable parallel work.

03 · COLLABORATION

git add .

git commit –m “new-feature”

git push

Canadian Bioinformatics Workshops | bioinformatics.ca

39 of 42

Pull requests (peer review).

#42 · feature/quantile-norm → main

OPEN

Add quantile normalisation to RNA-seq pipeline

2 commits, +148 / −31 lines

CI passing — all 14 tests green

Approved by @linda-x

!

1 unresolved comment from @mitchell-s

"Looks great — small nit on line 47, otherwise ready to merge once that's addressed."

A structured proposal for code changes before merging into the main branch

Collaborative feedback through inline comments, approvals, and revision cycles

Automated quality gates ensuring tests and checks pass before any merge

03 · COLLABORATION

Merge

Canadian Bioinformatics Workshops | bioinformatics.ca

40 of 42

Prerequisites

01

Git installed

Runs in a terminal, confirm with git --version

02

Registered on GitHub

Account at github.com, signed in

03

VS Code or RStudio installed

Either editor will work fine

QUICK ROOM CHECK

Hands up, who has all three?

Canadian Bioinformatics Workshops | bioinformatics.ca

41 of 42

SETUP · AUTHENTICATE YOUR TERMINAL

Login to GitHub from the terminal.

One-time setup so git push works without prompting for a password every time.

~/projects — zsh

$ gh auth login

? Where do you use GitHub? GitHub.com

? Preferred protocol? HTTPS

? Authenticate Git with your credentials? Yes

? How would you like to authenticate?

Login with a web browser

! First copy your one-time code: A1B2-C3D4

Press

Enter

to open github.com in your browser…

Authentication complete.

Logged in as your-username

$ gh auth status

github.com · token scopes: ‘repo’, ‘gist’, ‘workflow’

1

Install the GitHub CLI

Once per machine. brew install gh on macOS, package manager on Linux, installer on Windows.

2

Run gh auth login

Pick GitHub.com → HTTPS → Login with a web browser. Four prompts, ~20 seconds.

3

Paste the one-time code

Copy the 8-character code shown in the terminal, paste it on github.com when the browser opens, approve.

4

Verify with gh auth status

You'll see a green check and your username. From now on, git push just works.

Canadian Bioinformatics Workshops | bioinformatics.ca

42 of 42

40 MINUTES · HANDS-ON

To the lab.

17

Canadian Bioinformatics Workshops | bioinformatics.ca