~/notes/fetch-after-merging-a-pr

Fetch before branching after merging a PR from the CLI

gh pr merge merges on the server. Your local origin/main is still the old one until you fetch.

· 1 min read · written in English

gh pr merge --squash merges on GitHub. Locally, origin/main still points at the pre-merge commit. Branch from it and your new branch silently lacks the change you just merged. Files you edited a minute ago look reverted.

bash
git fetch origin
git switch -c next-thing origin/main