Quick Tip
You're mid-feature with 14 dirty files. Production is on fire. Instead of git stash roulette:
git worktree add ../hotfix main
cd ../hotfix
# fix the bug, commit, push
git worktree remove ../hotfix
git worktree checks out another branch into a separate directory — same repo, shared .git, no re-clone, no stash. Your feature branch sits untouched in the original directory.
Commands I actually use weekly:
git worktree list # see all active worktrees
git worktree add -b fix/typo ../typo main # create branch + worktree together
git worktree remove ../typo # clean up when done
Where this saved me last sprint: reviewing a teammate's PR while my own half-done migration was mid-refactor. PR in ../review, my mess stayed put, zero context switch.
Caveat: two worktrees can't check out the same branch — that's the whole point of the isolation.
Found this while cleaning up a MonkeyCode-assisted monorepo workflow: https://ly.cyberserval.tech/iIETXiF
Team stash or team worktree — which one lives in your muscle memory?
Top comments (1)
I love how you've highlighted the utility of
git worktreefor managing multiple branches without the hassle of stashing. It's indeed a game changer for maintaining focus while juggling urgent fixes and ongoing feature work. One practical insight I've found is to integrategit worktreeinto CI/CD pipelines for temporary environments, streamlining testing and reviews. If you're exploring ways to enhance your monorepo workflow further, I’d be interested in collaborating on this aspect. What additional features do you think could make this setup even more efficient?