Git-command chain hygiene (#33,#34,#35) (#63)

Co-authored-by: claude <claude@jpaul.io>
Co-committed-by: claude <claude@jpaul.io>
This commit was merged in pull request #63.
This commit is contained in:
2026-06-22 17:06:58 -04:00
committed by Claude (agent)
parent c34052665f
commit 6d28567c12
4 changed files with 33 additions and 15 deletions
+7 -4
View File
@@ -111,10 +111,13 @@ everywhere.
**2. The remote isn't empty (non-fast-forward).** You let the host create the repo *with* a README,
then push, and get `! [rejected] ... (fetch first)` or `non-fast-forward`. The remote has a commit
your local history doesn't, so Git refuses to overwrite it. Fix: either recreate the remote empty, or
reconcile once with `git pull --rebase origin main` and then push. (This is the same "someone else
pushed before me" situation you'll hit constantly once you're collaborating — Module 11 — except here
the "someone else" was the host's auto-generated README.)
your local history doesn't, so Git refuses to overwrite it. The simple fix is to **recreate the remote
empty** and push again. (The alternative you'll see online — `git pull --rebase origin main`, then
push — replays your commits on top of the remote's, but `rebase` is an advanced, history-rewriting
operation this course doesn't teach as a step here, so prefer the empty-remote fix for now. And note
that plain `git pull` won't rescue you against an auto-README remote — it refuses to merge unrelated
histories.) This is the same "someone else pushed before me" situation you'll hit constantly once
you're collaborating — Module 11 — except here the "someone else" was the host's auto-generated README.
**3. Branch-name mismatch.** Your local default branch is `master` but the host expects `main` (or
vice versa). `git push -u origin main` then errors with `src refspec main does not match any`. Fix: