CBIO7501 · Lesson 04
analysis_final_v2_REALLY_FINAL.py: history by file nameGit is an open-source, distributed version control system created by Linus Torvalds in 2005
Git keeps a complete history of the project/code: like a shared drive that keeps versions, except that you decide when a version is saved, and why.
GitHub keeps a copy and adds review and automation.
Note: Git is made for text (code, config, Markdown), not for large or binary data files.
| Word | Meaning |
|---|---|
| repository | the project folder plus its history (.git/) |
| commit | a snapshot, with a message, an author and an ID |
| branch | a separate line of work |
| remote | another copy of the repository, e.g. on GitHub (origin) |
| push / pull | send commits to / get commits from a remote |
| pull request | a proposal to merge a branch, with review and checks |
Figure: By Aziz Khan, CC BY 4.0
git status shows what changed in the working directorygit add FILEgit commit -m "Why this change"
Figure: By Aziz Khan, CC BY 4.0
git clone: your own full copy, history includedgit push: send your commits to GitHubgit pull: get the others’ commits (fetch + merge)| Commit | Do not commit |
|---|---|
| scripts, workflows, config | raw data (download it: scripts/download_data.py) |
pixi.toml, pixi.lock |
.pixi/ (rebuilt from the lock file) |
| report and notebook sources | rendered HTML, notebook outputs |
| metadata, checksums, README | results (rebuilt by pixi run reproduce) |
.gitignore makes this automatic.
.pixi/*
!.pixi/config.toml
data/raw/**
!data/raw/README.md
.
.
main ●───●───────────● (merge)
\ /
lesson-04-readme ●───●───● push → pull request → review + checks → merge
From now on: one branch and one pull request per lesson.
Figure 1: A branch is a label that points at a commit. While add-fastqc and fix-ref-path gain commits, main stays where it is. Each branch is merged back when its work is ready.
The template’s GitHub Action runs on every push and pull request: a fresh Linux machine, a clean clone of your repository, then pixi run reproduce.
reproduce is a placeholder: the check is green but proves little Figure: By Aziz Khan, CC BY 4.0
3 minutes. Your labmate leaves. You inherit a folder with 40 scripts and no history. Which three questions can you not answer? Which of them would Git have answered?
pixi.lock (b) data/raw/SRR2584863_1.trim.sub.fastq (c) scripts/download_data.pyYou deleted a file and committed the deletion. Can Git restore it? (yes / no)
Two branches change the same line. What does git merge do?
Now: tutorial 04.
Text and slides CC BY 4.0 unless marked otherwise. Full list: Sources and credits.
CBIO7501: The Art of Reproducible Research - CC BY 4.0