Git Worktree "Already Checked Out" Error: Safe Fix and Recovery Guide (2026)
Need a fast file comparison before deleting or reattaching a worktree? Use Git Diff Viewer to verify local changes and avoid dropping unresolved edits.
If you hit fatal: '<branch>' is already checked out at '<path>', do not force random commands. This guide gives a deterministic flow to locate branch ownership, clean stale metadata, and recover safely.
Table of contents
1. Confirm where the branch is attached
Start with an exact map of active worktrees and branch bindings.
git worktree list --porcelain
git branch --all --verbose --verbose
Look for the path currently owning the branch. If the path exists, decide whether to keep it or retire it.
--force to bypass branch ownership unless you have verified all uncommitted changes in the existing worktree.
2. Remove stale metadata safely
If the worktree directory was deleted manually, Git may keep stale admin records. Prune first:
git worktree prune
git worktree list --porcelain
Re-run your original add/switch command only after stale entries disappear.
3. Move branch ownership intentionally
When another valid worktree owns the branch, either remove that worktree or use a new branch name.
# Option A: remove old worktree (clean state required)
cd /path/to/main/repo
git worktree remove /path/to/old-worktree
# Option B: create a fresh branch for the new worktree
git worktree add -b feature/new-branch ../new-worktree origin/main
4. Recover after accidental directory deletion
If you deleted a worktree folder directly in the filesystem, use this order:
# clean stale references
git worktree prune
# verify branch tips
git reflog --date=iso --all | head -n 30
# recreate worktree cleanly
git worktree add ../restored-worktree your-branch
If commits appear missing, recover from reflog with the workflow in Git Reflog Recovery Guide.
5. Prevention checklist
- Always remove worktrees with
git worktree remove, not manual folder deletion. - Run
git worktree list --porcelainbefore reusing branch names. - Keep one branch per active worktree.
- Use a diff check before cleanup when you suspect uncommitted edits.
FAQ
Can I check out the same branch in two worktrees?
No. Git enforces single ownership of a branch across worktrees to prevent conflicting working states.
What if prune does not clear the error?
Run git worktree list --porcelain and inspect .git/worktrees/ for leftover entries. Confirm the path still exists and is accessible.
How do I avoid data loss during worktree cleanup?
Commit or stash changes before removal, then verify branch tip with git log --oneline --decorate -n 10 after recreating the worktree.