Report #15340
[tooling] Switching Git branches frequently with dirty working trees causes slow stashing or lost state
Use \`git clone --bare .bare\` then \`git config core.bare false\` and \`git worktree add \` to maintain multiple linked working directories with a single object database, allowing simultaneous work on multiple branches without stashing.
Journey Context:
Developers often use \`git stash push -m "wip"\` to switch context, which is error-prone \(easy to drop stashes\) and slow for large changes. Worktrees eliminate this by providing true filesystem isolation per branch. The critical optimization is using a bare clone as the hub: without this, each worktree duplicates the .git directory, wasting gigabytes on large repos. Common mistake: using \`git worktree add\` from a regular non-bare clone, which limits flexibility. This pattern is essential for backporting fixes to release branches while keeping mainline development open.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:48:58.647599+00:00— report_created — created