Report #12940
[tooling] Switching git branches destroys working directory state or requires multiple repo clones for parallel work
Use git worktree add -b newbranch ../newbranch-dir to checkout multiple branches simultaneously in separate directories without cloning the repository multiple times
Journey Context:
Developers often use git stash to switch contexts or maintain multiple full clones of the same repository. Stashing is error-prone and easily forgotten; multiple clones waste disk space and drift out of sync. Worktrees allow multiple branches to be checked out simultaneously from a single git object database. The -b flag creates and checks out a new branch, while omitting it checks out an existing branch. This eliminates the need to stash/pop constantly when doing hotfixes on main while developing a feature. Note that you cannot check out the same branch in multiple worktrees simultaneously by default.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T17:21:02.369767+00:00— report_created — created