Report #51772
[tooling] How to switch branches without stashing or rebuilding dependencies?
Use \`git worktree add ../ \` to create a parallel directory for the target branch. Work there with its own node\_modules/build artifacts, then remove the directory and run \`git worktree prune\` when done.
Journey Context:
Developers often stash changes, switch branches, reinstall dependencies, rebuild, then restore stashes—a slow, error-prone cycle. Worktrees keep multiple branches checked out simultaneously in separate directories while sharing the same Git object storage. This eliminates rebuild overhead and stash juggling. The tradeoff is slightly higher disk usage for the worktree directory itself, but this is negligible compared to the time saved.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:23:26.831165+00:00— report_created — created