Git: What It Does, and What to Say
You will never type a git command. Claude runs all of them, and asks your permission first. This page exists so you know what you're approving when a permission prompt mentions one of these, the terms are worth knowing even though the typing isn't yours to do.
The daily six
| What you want | Say this to Claude | The technical name, if you're curious |
|---|---|---|
| See what's changed since the last snapshot | "what's changed?" | git status |
| See the actual changes, line by line | "show me the diff" | git diff |
| Save a snapshot, labelled | "commit this with a sensible message" | git commit |
| See your snapshot history | "show the recent commits" | git log |
| Undo changes back to the last snapshot | "throw away these changes" | git checkout |
| Send your snapshots to GitHub (updates the live site) | "push it" | git push |
Notice the pattern: you describe the outcome you want, in plain English. Claude picks the command, shows you what it's about to run, and you say yes. That's true of every row above and everything below it.
The recovery ladder (calmest first)
When something's gone wrong, say the plainest thing that describes what you want. Start at the top and only go further down if it wasn't enough:
- "Undo that." Claude reverts its own last change.
- Press
Esctwice. Claude Code's own rewind, restores the conversation and the files to an earlier checkpoint. Not git; a Claude Code feature, and the fastest option when it applies. - "Throw away these changes." Existing files go back to the last
snapshot. Caveat: brand-new files Claude created stay put, if you want
those gone too, say "throw away all changes, including new files."
(Behind the scenes:
git checkoutfor existing files,git cleanfor new ones.) - "Go back to [an earlier commit], show me the list first." Rewinds
the whole project to any snapshot ever taken. Feels like it destroys
everything after that point; ask Claude to talk you through it the
first time, though even this is recoverable for weeks afterward,
because commits are very hard to truly lose. (
git reset --hard) - "Something's really wrong, can you get a fresh copy of my project
from GitHub?" If the project's state is beyond understanding, Claude
downloads your own repo again into a new folder. GitHub has everything
you ever pushed. (This is why you push.) (
git clone)
Three facts that explain everything
- A snapshot is forever, even "deleted" files live on in git's memory. Comforting for code; the reason secrets must never be committed (ask Claude to check before anything sensitive goes in).
- Rewind points are only as good as your snapshots → ask for a commit after every working change. It's not possible to commit too often.
- Everything is fixable except work you never asked Claude to snapshot.
Words you'll hear
- repo: a project folder git is watching
- commit: one snapshot
- branch: a parallel line of snapshots (you're fine on
mainalone for now; branches matter when there's more than one of you) - remote / origin: the GitHub copy of your project
- push: sending your snapshots to that GitHub copy