You try to switch to a branch and Git refuses.
git switch checkout-fix
fatal: 'checkout-fix' is already used by worktree at '/Users/you/code/acme/web-checkout-fix'
A branch can be checked out in only one worktree at a time. Another folder on your machine already has it open, and Git names that folder in the error.
Find the checkout
The error shows the path. To see every worktree and its branch, list them.
git worktree list
/Users/you/code/acme/web 25d710f [main]
/Users/you/code/acme/web-checkout-fix 2da99ea [checkout-fix]
To look up one branch, filter the list.
git worktree list | grep '\[checkout-fix\]'
Choose what to do
- Work in that folder. Open
/Users/you/code/acme/web-checkout-fixand carry on. Its edits and staging are still there. - Make a separate branch. If you only need the same commits, start a new branch from the old one. Nothing is moved or removed.
git switch -c checkout-fix-2 checkout-fix
Switched to a new branch 'checkout-fix-2'
- Free the original branch. Remove that worktree, after the check below.
Check for unsaved work before you free the branch
Look inside the other folder for changes, untracked files and ignored files.
git -C /Users/you/code/acme/web-checkout-fix status --short --ignored --untracked-files=all
M src/checkout.js
?? notes/checkout.md
M is an edit not yet committed. ?? is a file Git doesn’t track. !! would mark an ignored file, which Git can delete along with the worktree. Commit what you want to keep, or stash it. Once the output is empty, remove the worktree and the branch is free to switch to.
See your worktrees together
push& (Pushand) groups linked worktrees under their repository, so you can see which folders hold which branches and what’s waiting to be pushed. See what it shows.