Report #11786
[tooling] Switching Git branches with uncommitted work without losing state or stashing
Use \`git worktree add ../ \` to checkout the target branch into a separate directory, leaving your current working tree untouched and avoiding stash/pop cycles.
Journey Context:
Developers typically stash changes, switch branches, and pop later, which risks conflicts or lost state if the stash is forgotten. Worktrees create independent working directories linked to the same repository, allowing simultaneous work on multiple branches with separate state. The tradeoff is slightly increased disk usage for the working tree files \(not the git history\), but modern filesystems use hardlinks where possible. This is superior to cloning the repo twice, which duplicates the object database.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T14:17:14.356155+00:00— report_created — created