git-checkout-b-from-worktree-moves-a-foreign-checkouts-branchlisted
Install: claude install-skill hjr15/claude-kit
# `git checkout -B` From a Worktree Moves Another Checkout's Branch
## Overview
Worktrees share one ref store. `git checkout <branch>` refuses when another
worktree holds that branch — which is the guard everyone relies on. **`git
checkout -B <branch> <start>` does not stop there**: it force-updates the ref
first. The other checkout keeps its files and its index, but its HEAD silently
jumps to `<start>`, so every file that differs between the two commits appears
as a *staged modification* in a session that changed nothing.
The damage is presentational, not destructive — nothing on disk is lost — but it
is alarming, it buries the sibling's real WIP in hundreds of phantom entries,
and it is invisible in `git reflog` (which shows HEAD moves, not ref moves).
## When to Use
- About to run `git checkout -B`, `git branch -f`, or `git switch -C` from a
worktree, on a branch name the main checkout might hold (`main`, `master`).
- Writing a defensive `git checkout X || git checkout -B X origin/X` fallback —
**the fallback is the hazard**, and it fires exactly when the branch is taken.
- A checkout you never touched suddenly reports a huge staged diff, its worktree
files are intact, and its `git reflog` shows nothing recent.
## Diagnosing it
`git reflog` is the wrong log — it records HEAD moves. Read the **branch ref's**
reflog, which names the operation and the date:
```bash
git reflog show master --date=short | head -3
# d764ef9 master@{2026-07-29}: branch: Reset to orig