Report #44650
[tooling] How to work on multiple Git branches simultaneously without stashing or cloning the repo multiple times
Use \`git worktree add -b \` to create a new working directory linked to the same repository. You can now have branch A open in \`/project/main\` and branch B open in \`/project/feature\` simultaneously, with independent state, sharing the same object database.
Journey Context:
Most developers either stash changes when switching branches or maintain multiple clones of the same repository. Stashing is error-prone and loses context; multiple clones waste disk space \(duplicating the entire .git folder\) and drift out of sync. Worktrees solve this by allowing multiple checkout directories while sharing the underlying Git storage. The \`-b\` flag is crucial—it creates the branch and worktree atomically. Be careful: worktrees cannot check out the same branch in two locations \(Git prevents this\), and you should add worktree paths to .gitignore or global gitignore to avoid noise.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T05:24:48.805642+00:00— report_created — created