🔀 The Branch You Need Is ‘Already in Use’ Somewhere Else
Git worktrees let you have several working directories from a single repository, checked out to different branches at the same time – but Git refuses to check out the SAME branch into two worktrees at once, and the error message doesn’t always make clear which other worktree is holding onto it.
🔎 The Problem
$ git worktree add ../hotfix-review feature/checkout-flow fatal: '"'"'feature/checkout-flow'"'"' is already checked out at '"'"'/home/dev/project-worktrees/feature-work'"'"' # Git treats a branch as a single checkout target across the whole # repository - it can be the current branch in only one worktree (or # the main working directory) at a time, by design, to prevent two # working directories from independently modifying the same branch # and silently clobbering each other'"'"'s changes.
✅ Fix: Find the Other Worktree, or Use a Detached Checkout
- `git worktree list` shows every worktree and which branch each one currently has checked out – the fastest way to find exactly where the branch is already in use before deciding what to do about it.
- If the other worktree isn’t actively being used, `git worktree remove <path>` frees the branch up, or simply switching that worktree to a different branch (`git -C <path> switch main`) releases the lock without deleting anything.
- For read-only inspection – reviewing a branch without needing to commit to it – `git worktree add –detach ../hotfix-review feature/checkout-flow` checks out that commit in a detached HEAD state, which Git allows in multiple worktrees simultaneously since there’s no branch pointer being shared.
⚠️ Why This Trips Up Teams New to Worktrees
- The restriction applies to the branch, not the commit – two worktrees can absolutely be at the exact same commit as long as neither one has that commit’s branch checked out by name, which is a subtle enough distinction to cause confusion the first few times.
- A worktree left behind after its directory was deleted manually (instead of through `git worktree remove`) still shows up in `git worktree list` as holding its branch – `git worktree prune` clears out these stale, no-longer-existing entries.
A branch can live in more than one place on disk, but Git only ever lets one of them actually claim to be it.
