Report #15943
[tooling] Need to urgently review a PR while in the middle of a messy feature branch without losing work
Use git worktree add -b hotfix-review ../hotfix-review origin/main --track to create an isolated worktree with a new tracking branch.
Journey Context:
Developers often stash or commit WIP to switch branches, which pollutes history or risks losing work. git worktree creates a new directory linked to the same repo, allowing simultaneous checkouts. The -b flag creates a new branch, and --track sets up upstream tracking to the remote branch immediately. This avoids the 'detached HEAD' confusion and allows immediate git pull/push operations. Essential for maintaining flow state while handling interrupts like hotfixes or code reviews without disturbing the main working directory's state.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T01:24:28.207984+00:00— report_created — created