AY 2026 T1

Git and GitHub Collaboration

Workflows for scientific collaboration

The Problem: File Sprawl

Ad-hoc Versioning
Ad-hoc File Naming
analysis.py
analysis_v2.py
analysis_final.py
analysis_final_really_FINAL.py
analysis_final_reviewer_OCT14.py
→
[ Next: Version Control ]

The Solution: Single File & Full History

Clean Project
Ad-hoc File Naming
analysis.py
analysis_v2.py
analysis_final.py
analysis_final_really_FINAL.py
analysis_final_reviewer_OCT14.py
→
Single File • Full History
analysis.py main
● 31c0a • Add reviewer edits
● 9b2d8 • Refactor plotting module
● e4a10 • Baseline analysis script

Git vs GitHub

Distinction
Git
GitHub

Git vs GitHub

Distinction
Git
Local Engine Runs on your computer
GitHub
Collaborative Platform Sharing, code review & sync

Git vs GitHub

Distinction
Git
Local Engine Runs on your computer
Offline Tracking Project history without internet
GitHub
Collaborative Platform Sharing, code review & sync
Cloud Hub Central remote repository

Commits

Linear History
c1: init repo main

Commits

Linear History
c1: init repo c2: clean data main

Commits

Linear History
c1: init repo c2: clean data c3: plot pipeline main

Commits and Collaborative Branches

Feature Branch
c1: init c2: clean c3: pipeline Person B starts b1: new metric main feature

Commits and Collaborative Branches

Feature Branch
c1: init c2: clean c3: pipeline Person B starts b1: new metric Person B continues b2: validation main feature

Commits and Collaborative Branches

Branch & Merge
c1: init c2: clean c3: pipeline merge commit Person B starts b1: new metric Person B continues b2: validation main feature

Three Stages of Git

Local Workflow
Working Directory
Files on your computer with active, unrecorded edits
[ Edit files in editor ]
git add
git commit

Three Stages of Git

Local Workflow
Working Directory
Files on your computer with active, unrecorded edits
[ Edit files in editor ]
git add
Staging Area
Selected changes gathered and prepared for the snapshot
Index ready to pack
git commit

Three Stages of Git

Local Workflow
Working Directory
Files on your computer with active, unrecorded edits
[ Edit files in editor ]
git add
Staging Area
Selected changes gathered and prepared for the snapshot
Index ready to pack
git commit
Local Repository
Permanent snapshot sealed into project history (.git)
Stored in time machine

Collaborating with Remotes

Local Setup
Computer A local repo

Collaborating with Remotes

Push
GitHub remote: origin Computer A local repo git push

Collaborating with Remotes

Pull
GitHub remote: origin Computer A local repo Computer B local repo git push git pull

Collaborating with Remotes

Bidirectional Sync
GitHub remote: origin Computer A local repo Computer B local repo git push git pull git pull git push

Rules in Teams

Practices
Rule 01
Pull Before Starting

Rules in Teams

Practices
Rule 01
Pull Before Starting
Rule 02
Atomic Changes

Rules in Teams

Practices
Rule 01
Pull Before Starting
Rule 02
Atomic Changes
Rule 03
Clear Commit Messages

Interactive Practice

Hands-on
01 • SETUP Configure git identity & initialize repo
02 • LOCAL Track files: add, commit & check log
03 • REMOTE Link & push to remote on GitHub
04 • COLLABORATE Pair up & resolve a simulated merge conflict