Git: A Mental Model for Version Control
Git becomes much easier when you stop treating it as a bag of commands.
Think of it as a graph of snapshots.
repository working tree staging area commit branch HEAD merge rebase remote fetch pull push
The three places
Working directory
│ git add
▼
Staging area
│ git commit
▼
Repository history
A basic rhythm:
git status
git add analysis.py
git commit -m "Add bootstrap analysis"
git log --onelineBest resources
Pro Git — free official book:
https://git-scm.com/book/en/v2
Git Reference:
https://git-scm.com/docs
Learn Git Branching — visual and interactive:
https://learngitbranching.js.org/
GitHub’s Introduction to Git:
https://github.com/skills/introduction-to-git
Practice visually
Use Learn Git Branching to see:
A──B──C main
\
D──E experiment
Commands such as merge and rebase make far more sense when you can visualize the commit graph.
Before using destructive-looking commands copied from the internet, understand what will happen to the working tree, index and commit graph. git status is your friend.
Next: GitHub — Collaboration, Pull Requests & Portfolio