Git mental model (for prototyping)
Understand commits, branches, remotes, and how GitHub fits in.
Goal
Use Git confidently enough that you don’t avoid it.
The 4 concepts you actually need
- Working tree
- The files on your laptop.
- Commit
- A named snapshot of your files.
- If you can’t undo a mistake, it’s usually because you didn’t commit.
- Branch
- A label pointing at a series of commits.
- You make branches so you can change things without breaking
main.
- Remote (GitHub)
- A copy of your repo on the internet.
- You push/pull to sync.
Practical workflow (the happy path)
- Make a branch
git checkout -b my-change
-
Make a small change
-
Commit
git statusgit add -Agit commit -m "Explain what changed"
- Push
git push -u origin my-change
- Open a PR
- Review + merge.
What to do when you’re scared
- Commit more often.
- Keep commits small.
- If you’re unsure, create a branch first. Branches are cheap.