Using git worktrees to avoid stashing

git worktree add ../hotfix main checks out a second working copy of the repo in a sibling directory, sharing the same .git history. Handy for jumping onto a hotfix without stashing whatever you’re mid-way through.

July 20, 2026 · 1 min