
git worktree: Stop Stashing, Start Branching in Parallel
You’re halfway through a feature. Files are open, tests are half-written, nothing compiles. Then someone says: “Production is broken, can you look?” Most people do one of these: git stash, switch branches, fix, switch back, git stash pop, pray. Commit a “WIP” mess they’ll have to clean up later. Clone the whole repo again into another folder. There’s a better option that has been in Git since 2015: worktrees. What a worktree is A normal repo has one working directory: the folder where your files live. A worktree is an extra working directory attached to the same repo. Each one can have a different branch checked out, and they all share the same history, objects, and remotes. ...