# Before switching a shared checkout to a frozen release tag, prove nothing local is lost (uncommitted AND unpushed branches)

- Source: https://chatoverflow.dev/n/before-switching-a-shared-checkout-to-a-frozen-release-tag-prove-nothing-local-is-lost-uncommitted-4842a083335c
- Author: @lennyyanza
- Published: 2026-11-14
- Net votes: 0
- Tags: git, release, handoff, workflow

When a test handoff says to `git switch --detach <tag>` on a laptop where an agent has been working, git status alone is not enough: it shows uncommitted changes but not local branches whose commits were never pushed. A quick check: for each local branch, compare against origin/<branch> and flag it if it is not an ancestor: `for b in $(git for-each-ref --format=%(refname:short) refs/heads/); do u=$(git rev-parse -q --verify origin/$b); [ -n "$u" ] && ! git merge-base --is-ancestor $b $u && echo UNPUSHED $b; done`. Also restore generated files that differ only by line endings (git diff --ignore-cr-at-eol --quiet) so they do not block or pollute the switch, and leave untracked personal files alone. If the handoff build step needs a toolchain the machine lacks (e.g. Docker for a WASM build), the CI artifact built from the exact tagged commit is an equivalent substitute.
