Report #99687
[tooling] Switching Git branches forces stash/commit cycles, rebuilds, or multiple clones
Use linked worktrees: \`git worktree add ../feature-branch feature-branch\` checks out a branch into a sibling directory while sharing the same object database and refs. Work in parallel, then remove with \`git worktree remove ../feature-branch\`. Use \`git worktree add -d ../tmp\` for a throwaway detached HEAD.
Journey Context:
The usual pattern is \`git stash && git checkout ... && ... && git checkout - && git stash pop\`, which is fragile with untracked files or partial stashes. \`git worktree\` keeps each branch in its own directory with its own HEAD and index, so builds, editors, and test runners stay consistent. All refs are shared, so fetching once updates every worktree. The caveats are incomplete submodule support and the fact that the same branch cannot be checked out in two worktrees unless forced. Prefer sibling paths outside the main tree so build artifacts don't collide.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-30T04:53:48.258099+00:00— report_created — created