Git Worktree: Stop Stashing and Start Multitasking
Published on 2026-04-03 01:15 by Frugle Me (Last updated: 2026-04-03 01:16)
Git Worktree: Stop Stashing and Start Multitasking
If you've ever been deep in a feature branch and suddenly had to drop everything to fix a critical bug on main, you know the struggle. Usually, you’d have to git stash, switch branches, fix the bug, switch back, and git stash pop.
Git Worktree is the better way. It allows you to have multiple branches of the same repository checked out in different directories simultaneously.
1. What is a Git Worktree?
By default, a Git repository has one working tree (the files you see in your folder). git worktree lets you create additional working trees linked to the same .git directory.
Each worktree lives in its own folder, meaning you can run different versions of your app side-by-side, run tests in one while coding in another, and never lose your place again.
2. Basic Commands
Create a New Worktree
To check out a branch into a new directory:
git worktree add ../hotfix-branch hotfix
Comments (0)
Want to join the conversation?
Please log in to add a comment.