git worktree lets you have multiple working trees from one repo — no stashing, no switching, no friction.
git worktree lets you check out multiple branches from the same repository simultaneously, each in its own directory. No stashing, no branch switching, no losing your current working state.
# You're on main, working on something. A hotfix lands.
git worktree add ../portfolio-hotfix hotfix/navbar-crash
# Now you have two working trees:
# /portfolio → main branch (current work untouched)
# /portfolio-hotfix → hotfix/navbar-crash (clean checkout)Go fix the hotfix, push it, then clean up:
Karanveer Singh Shaktawat
Full Stack Engineer & Infrastructure Architect
Building portfolio, contributing to open source, and seeking remote full-time roles with significant technical ownership.
Pick what you want to hear about — I'll only email when it's worth it.
Did this resonate?
git rerere remembers how you resolved a merge conflict and automatically applies the same resolution next time. Useful for long-lived feature branches.
One changed line in a Dockerfile invalidates every layer after it. Ordering your Dockerfile with this in mind cuts rebuild times dramatically.
cd ../portfolio-hotfix
# fix the bug, commit, push
cd ../portfolio
git worktree remove ../portfolio-hotfixgit worktree list
# /Users/xczer/portfolio abc1234 [main]
# /Users/xczer/portfolio-hotfix def5678 [hotfix/navbar-crash]Stashing saves uncommitted changes but leaves your branch in a clean state — then you switch branches and switch back. With a messy mid-refactor working tree, stash → switch → fix → switch back → pop is friction.
Worktrees keep both states alive simultaneously. You don't need to remember to pop the stash. You don't risk a stash conflict. You just work in two directories.
On this portfolio I use worktrees when I want to run bun run build on a previous commit to bisect a regression while still editing files on the current branch. Without worktrees, you'd need two repo clones.
You can't check out the same branch in two worktrees simultaneously. Each branch can only be active in one worktree at a time. Git enforces this — it prevents the confusion of two working trees diverging from the same branch tip.