Skip to content

date: 2026-06-16 tags: [git, claude-code-web, branching, footgun] status: active graduated_to:

In the web env, git checkout main lands on a STALE main — branch off origin/main

Symptom — Started a feature branch with git checkout main && git checkout -b feat/x; the working tree reverted to a much older state (the old terminal theme / "Guide" nav), silently dropping several already-merged PRs. A branch nearly got based on pre-merge main. Happened twice in one session.

Root cause — The Claude Code on-the-web container's local main is never fast-forwarded as PRs merge on the remote. git fetch updates origin/main, but local main stays pinned at the commit the container cloned. So git checkout main checks out that stale snapshot, and branching off it bases new work on an old tree — which then conflicts on merge or quietly clobbers merged work.

Fix — Don't trust local main in a web session. Branch straight off the freshly-fetched remote, fetching immediately before each new branch (merges land between branches in a fast loop):

bash
git fetch origin main && git checkout -B <branch> origin/main

Guard — none automatic; it's a habit. After branching, a one-line sanity grep for a recently-merged change (e.g. grep -c <expected-string> <file>) confirms the base is current before you start editing.