Fix: “Branch Already Checked Out” in Worktree
You try to create a new git worktree or switch branches, and Git shows this error:
$ git worktree add ../feature-worktree feature/dashboard
fatal: 'feature/dashboard' is already checked out at '/home/user/project-dashboard'This is a safety mechanism, not a bug. Git is protecting you from data corruption.
Why Git Prevents This
Git does not allow the same branch to be checked out in two worktrees at the same time. If it did, both worktrees would share the same branch ref (the pointer that tracks the latest commit). When you commit in one worktree, the branch ref moves forward, but the other worktree would not know about it. This leads to several problems:
- Commits made in one worktree could silently overwrite commits made in the other.
git statuswould show incorrect results because the index and working tree would be out of sync with the branch ref.- Merges and rebases could produce unpredictable results.
By enforcing one checkout per branch, Git ensures that each working directory has exclusive control over its branch pointer.
Finding Which Worktree Has the Branch
The error message tells you the path, but you can also list all worktrees and their branches:
$ git worktree list
/home/user/project abc1234 [main]
/home/user/project-dashboard def5678 [feature/dashboard]
/home/user/project-api ghi9012 [feature/api]The branch name in square brackets shows which branch each worktree has checked out. In this example, feature/dashboard is checked out in /home/user/project-dashboard.
Solutions
Solution 1: Use the Existing Worktree
The simplest solution — just cd to the worktree that already has the branch:
cd /home/user/project-dashboard
# You're now on feature/dashboard, ready to workSolution 2: Use a Different Branch
Create a new branch for the second worktree instead:
# Create a new branch based on the same commit
git worktree add -b feature/dashboard-v2 ../dashboard-v2 feature/dashboardSolution 3: Remove the Other Worktree First
If you no longer need the existing worktree, remove it:
# Remove the worktree that has the branch
git worktree remove /home/user/project-dashboard
# Now you can create a new one
git worktree add ../new-dashboard feature/dashboardIf the worktree directory was already deleted manually, prune first:
git worktree prune
git worktree add ../new-dashboard feature/dashboardSolution 4: Force Checkout (Use with Caution)
Warning: Using --forcebypasses Git’s safety check. If you make commits in both worktrees on the same branch, one set of commits will be lost. Only use this if you understand the risk and have a specific reason.
# Force checkout of a branch that's already checked out elsewhere
git worktree add --force ../dashboard-copy feature/dashboard
# The branch is now checked out in TWO worktrees.
# Be very careful: do NOT commit in both.A safer alternative to --force is to use a detached HEAD so the branch ref is not shared:
# Check out the same commit without checking out the branch
git worktree add --detach ../dashboard-review feature/dashboard
# This creates a worktree at the same commit but in detached HEAD mode.
# Safe to browse and test, but commits won't update the branch.Related
- git worktree add — Full guide on creating worktrees
- Fix: invalid reference — Another common worktree add error
- Fix: cannot delete branch used by worktree
- All troubleshooting guides