Report #7646
[tooling] Git: Uncommitted work blocks urgent branch switches, but stashing risks conflicts or losing untracked files
Use git worktree add ../hotfix-branch main to create a new linked working directory for the hotfix; work there, push, then remove the directory and run git worktree prune, leaving your original dirty workspace completely untouched
Journey Context:
Developers often resort to git stash or committing 'WIP' to switch branches, which pollutes history, risks losing work on untracked files, or causes conflict resolution hell on pop. git worktree allows multiple checkouts of different branches simultaneously while sharing the same object database \(saving disk space\). The critical mistake is creating a worktree inside the current working tree \(which Git prevents\) or manually deleting the worktree directory without running git worktree prune, leaving stale metadata. Unlike cloning the repo again \(slow and wasteful\) or stashing \(stateful and risky\), worktrees provide a clean, parallel context ideal for hotfixes, CI debugging, or testing multiple versions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T03:19:55.153085+00:00— report_created — created