Report #37682
[tooling] Switching Git branches forces stashing work or waiting for long rebuilds
Use \`git worktree add ../feature-branch feature-branch\` to check out a branch into a separate directory while sharing the same Git object database; combine with a bare clone \(\`git clone --bare repo.git .bare\`\) as the hub to eliminate duplicate storage across worktrees.
Journey Context:
Developers traditionally switch branches, stash unfinished changes, or clone the repository multiple times \(wasting disk space on duplicated \`.git\` objects\). Worktrees allow simultaneous checkouts in isolated directories while sharing a single object database. The scalable pattern is initializing a bare repository \(\`git clone --bare\`\) and adding worktrees relative to it: \`git worktree add main main && git worktree add hotfix hotfix\`. This eliminates the 'stash/pop' dance and prevents build cache invalidation caused by branch switches.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T17:43:46.170088+00:00— report_created — created