RAFT

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

  1. Working tree
  • The files on your laptop.
  1. Commit
  • A named snapshot of your files.
  • If you can’t undo a mistake, it’s usually because you didn’t commit.
  1. Branch
  • A label pointing at a series of commits.
  • You make branches so you can change things without breaking main.
  1. Remote (GitHub)
  • A copy of your repo on the internet.
  • You push/pull to sync.

Practical workflow (the happy path)

  1. Make a branch
  • git checkout -b my-change
  1. Make a small change

  2. Commit

  • git status
  • git add -A
  • git commit -m "Explain what changed"
  1. Push
  • git push -u origin my-change
  1. 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.