Git Worktree "Already Checked Out" Error: Safe Fix and Recovery Guide (2026)

Published February 28, 2026 · 7 min read

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
  2. Remove stale worktree metadata
  3. Move branch ownership intentionally
  4. Recover after accidental directory deletion
  5. Prevention checklist

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.

Warning: Do not use --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
Tip: If you only need parallel experimentation, use separate branch names per worktree instead of reusing one branch in multiple directories.

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

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.