
git worktree: Work on Multiple Branches at the Same Time
Most developers handle parallel work one of two ways — stash everything and switch branches, or clone the repo a second time. Both work, but both have friction. git worktree is the cleaner solution that ships with Git itself. What it does git worktree lets you check out multiple branches simultaneously, each in its own directory on disk. They share the same Git history and object database, so there's no duplication, no sync issues, and no separate remote to manage. Basic usage git worktree add ../project-hotfix hotfix-branch You now have two working directories: /project — your original branch, untouched /project-hotfix — hotfix-branch, fully checked out and ready Open a second terminal, cd into the new folder, and work normally. Both are live at the same time. Practical scenarios Production bug comes in mid-feature Don't stash. Don't switch. Just open the hotfix worktree in a new terminal, fix it, push, close the terminal. Your feature branch is exactly as you left it. Running tests o
Continue reading on Dev.to Tutorial
Opens in a new tab



