1 of 18

Project Management and Git

Dennis Hazelett

Lecture 11 of “Applied Computational Genomics”

Spring 2022

This work, “Project Management and Git”, is licensed under CC BY SA 4.0 by Dennis Hazelett. Dinosaur image is from National Geographic “Billions of T. Rex likely roamed the Earth, paleontologists report”

2 of 18

Why Git?

  • Document changes to a project over time
  • Document author contributions
  • Track issues
  • Share pipelines & receive useful feedback
  • Restore the project to a prior state
  • Create your own version of someone else’s project/analysis

3 of 18

The Git workflow

Stage new changes

Commit changes

Push to remote

4 of 18

What happens when we work on a project?

Project start

*

git add file_A.txt

“file_A.txt”

git add file_B.txt

HEAD

git commit ...

HEAD

MASTER

“Staging”

5 of 18

This is called a “local” repository (on your personal machine)

*

“file_A.txt”

MASTER

HEAD

6 of 18

Commit ID, parents and children

*

MASTER

HEAD

73db731

“child”

“parent”

7 of 18

Tags create extra flexibility for tracking progress

*

MASTER

HEAD

Release v0.9

“Tags” empower you to create stable releases or mark projects for publication

8 of 18

Tag example: Curriculum Vitae

MASTER

HEAD

“R01-42356 Enhancers”

Annotation: submitted spring 2021

“Tags” empower you to create stable releases or mark projects for publication

NIH Biosketch

Curriculum Vitae

*

9 of 18

Local vs Remote repositories

10 of 18

What is happening at the remote repository?

*

MASTER

HEAD

HEAD

MASTER

git push

11 of 18

Working collaboratively

A*

MASTER

HEAD

A

B

12 of 18

Working collaboratively

A*

TESTPILOT

HEAD

B

C

MASTER

$git add file_C.txt

$git add file_B.txt

B*

$git commit -m ‘add C’

TESTPILOT

HEAD

$git branch -c Testpilot

https://www.atlassian.com/git/tutorials/using-branches

13 of 18

Working collaboratively: the remote repo

A*

MASTER

HEAD

A

B

2 CHOICES:

  • Switch to Master locally, merge Testpilot in and then push
  • Create “Pull request”

14 of 18

Creating a new “repo”

Project start

“file_A.txt”

HEAD

MASTER

  1. Create a new repo on github and clone it locally
  2. Create a project locally, and add it to an empty remote repo of the same name
  3. Clone an existing repo and start contributing

15 of 18

Creating a local mirror of the remote repo

16 of 18

Add an existing repo within Rstudio

17 of 18

The Git workflow

18 of 18

Homework for this lecture

Create a github account

Set up 2FA

Create a private repo in your account for this class

Clone the repo on your local computer and edit the README.md

Load all the past and present homework into your repo, stage, commit and push it to the remote

Add users ‘dennishazelett’ and ‘Simon-Coetzee’ with “view” permission

Hints:

  • Edit the homework markdown in Rstudio
  • You can interact with github in Rstudio directly