What Is git worktree and When Should You Use It?
git worktree lets you check out multiple branches of the same repository into separate directories at the same time, without cloning it again.
Published September 29, 2026
git worktree lets you check out several branches at once in separate folders that share one repository, so you can switch tasks without stashing.
How it works
Each worktree has its own working directory and HEAD, but they share the object database, saving space compared with multiple clones.
Handy for reviewing a pull request, hotfixing while a long build runs or comparing versions.
Try it
git worktree add ../hotfix main
Preparing worktree (checking out 'main')
git worktree list
/app a1b2c3 [feature] /hotfix d4e5f6 [main]
Practical examples
Add a worktree for a new branch
git worktree add -b hotfix ../app-hotfix mainList
git worktree listRemove
git worktree remove ../app-hotfixClean stale entries
git worktree pruneCommon mistakes
- Checking out the same branch in two worktrees (not allowed).
- Deleting the folder instead of git worktree remove.
- Forgetting dependencies must be installed in each folder.
Key takeaways
- Many working folders, one repo.
- No stashing for quick context switches.
- Use worktree remove to clean up.
FAQ
Worktree vs clone?
Worktrees share history and are lighter.
Can I run two builds at once?
Yes, each worktree is independent.