Git, for People Who Never Got Good at GitHub

Git, for People Who Never Got Good at GitHub
Git, for People Who Never Got Good at GitHub You don't need to run it. You need to know what it's doing, and what to say. Agentic SDLC · The Multiverse School 1 · “3 COMMITS BEHIND MAIN” Not an error. Not your fault. It means other people shipped while you were working. main 3 commits you don’t have your branch — still where you left it SAY THIS TO CLAUDE main has moved on — bring my branch up to date with it and tell me if anything conflicts. Doing this often is the whole trick. Drift is what makes merges scary. 2 · MERGE CONFLICT Two people changed the same lines. Git will not guess which one is right, so it asks. you changed line 42 they changed line 42 <<<<<<< HEAD price = 9.99 ======= price = 12.00 >>>>>>> main yours theirs SAY THIS TO CLAUDE show me both versions side by side in plain language and tell me which to keep and why. You delete the markers and keep the right code. That is the entire fix. 3 · MERGE VS REBASE Same destination, two different shapes of history. Both are fine; one of them is dangerous at the wrong moment. MERGE — keeps both threads join commit REBASE — replants onto the tip one clean line lifted from here, replayed on top The one rule that matters Never rebase anything you have already pushed and shared. SAY THIS TO CLAUDE rebase onto main — but only if I haven’t pushed. 4 · FORCE PUSH A normal push adds. A force push overwrites — it can delete work that was already on GitHub. on GitHub, before a teammate’s commit after your force push gone, with no warning to them SAY THIS TO CLAUDE never force-push a shared branch. If you think you need to, explain why first and wait. On your own unshared branch it is harmless. That is the whole distinction. 5 · FORK VS BRANCH A branch lives inside a repo you can write to. A fork is your own copy of the whole repo, for when you can’t. their repo a branch your fork of it a whole copy under your name PR Your own project, or your team’s: branch. Someone else’s open-source repo: fork, then PR back. The PR flow is identical either way — only the starting copy differs. SAY THIS TO CLAUDE do I need a fork here, or can I just branch? 6 · “WHERE DID MY WORK GO?” Detached HEAD, a bad reset, a checkout at the wrong moment. It is almost never actually gone. main your commits, still here just not on any branch git keeps a diary of everywhere HEAD has been The reflog. It survives resets, and it is how work gets recovered. SAY THIS TO CLAUDE I think I lost work — check the reflog and any stashes before we do anything else. Say it before you try to fix it yourself. Fixing is what loses things. 7 · WHAT THE PULL REQUEST PAGE IS TELLING YOU The concept is easy. The screen is what’s opaque. Here is the same page with the five things that actually matter marked. Add knockback to fireball #412 Open lizthedeveloper wants to merge 4 commits into production from feature/knockback Conversation 8 Commits 4 Checks 2 Files changed 12 1 This branch is out-of-date with the base branch Merge the latest changes from production into this branch. Update branch 2 All checks have passed 2 successful checks — lint, unit tests red here means the gate did its job — do not merge 3 Merge pull request 4 the caret is the part nobody clicks — it holds three different merges • Create a merge commit keeps every commit + a join dot • Squash and merge your 4 commits become 1 — usually what you want • Rebase and merge replays them onto the tip, no join dot A human clicks this. Agents prepare it — they do not press it. 5 what “Files changed” actually shows you spells/fireball.ts +2 −1 applyBurn(target) + applyKnockback(target, 3) − return damage green is added, red is removed — that is the whole notation SAY THIS TO CLAUDE walk me through this PR page: what changed, whether the checks passed, and whether it’s safe for me to merge. 8 · THE WORD → WHAT IT IS → WHAT YOU SAY You are not memorising commands. You are learning to recognise the word and hand the job over. WORD WHAT IT ACTUALLY IS WHAT YOU SAY clone get a copy of the repo onto your machine clone this and get it running locally branch a line of work off the shared line make a branch for this before you start commit one save point, with a message commit this with a message saying why, not what push / pull send yours up / bring theirs down push this branch and open a PR fetch look at what changed without touching your work fetch and tell me what moved on main PR a request to merge, with a review gate on it open a PR against production draft PR a PR that says explicitly: not ready yet open it as a draft, I'm not done merge join two lines of work together merge main into mine and handle the conflicts conflict two people edited the same lines show me both sides in plain language rebase replant your commits on top of the latest rebase onto main — only if I haven't pushed squash collapse several commits into one squash these into one commit before merging stash park uncommitted work somewhere safe stash what I've got, I need to look at main revert undo a commit by adding its opposite revert that commit — don't rewrite history reset move the pointer; can discard work don't reset without telling me what I'd lose force push overwrite what is already on GitHub never on a shared branch — explain why first cherry-pick take one commit from another branch cherry-pick just that fix onto patch tag a permanent name for one commit, e.g. a release tag this v1.8.0 and draft the release notes worktree a second checked-out copy on disk give each agent its own worktree origin the copy that lives on GitHub HEAD where you are standing right now If a word here shows up and you can’t place it, that is a completely normal thing to say out loud in chat.

Tour mode

Space / next · previous
Home / End first / last
19 jump to frame

Explore mode

Click any highlighted region to zoom in.
Click further-in regions to drill deeper.
Backspace / Esc — zoom back out
O — return to overview

Anywhere

M — toggle mode
T — toggle frame list
F — fullscreen · R — restart
0 / 0 Tour