On macOS, remove a finished linked worktree from Terminal with git worktree remove, but first check whether it contains changes you still need. Git removes a clean worktree; if it is dirty, it stops unless you force removal. To keep unfinished work, commit it or stash it before removing the directory. Do not add --force just to get past Git’s warning: it can discard the worktree’s local files. These steps apply to linked worktrees, not the repository’s main working directory. Git’s worktree documentation
1. Find the worktree and check its state
Open Terminal and go to the main repository or any linked worktree that belongs to the same repository. To see all associated worktree paths and branches, run:
git worktree list
Copy the exact path of the finished worktree. Then inspect its status from inside that worktree, quoting the path if it contains spaces:
cd "/path/to/finished-worktree"
git status --short --branch
The status output helps reveal modified or staged tracked files and untracked files. Also check the worktree in Finder for local files your workflow depends on. Files ignored by Git may not appear in ordinary status output. If you are unsure whether anything in the directory is disposable, stop before removal and make a separate backup or preserve the directory. A Git worktree shares repository data with its main worktree, but has its own checkout and index; removing the checkout is not a general-purpose backup operation. Git worktree documentation
2. Preserve changes you want to keep
If the work is ready to retain in the repository, commit it on the worktree’s branch. First review the status and diff, then stage only the files you intend to include and commit them:
git diff
git add path/to/file
git commit -m "Describe the finished work"
Remove the accidental leading space before git commit if your shell treats it unexpectedly; a clean form is git commit -m "Describe the finished work". A commit keeps the changes in Git history, but check that it is on the intended branch before you remove the worktree.
If the changes are unfinished, stash tracked edits and untracked files instead:
git stash push -u -m "Before removing finished worktree"
git stash list
The -u option includes untracked files. Ignored files are not included, so preserve any ignored local configuration, generated files, or other needed data separately. Confirm the new stash appears in the list before proceeding. Stashes belong to the repository, and you can later apply the saved changes from another worktree with git stash apply stash@{0}; verify the entry number first, because later stashes can change the list order. Applying a stash can produce conflicts, so inspect the result before deleting the stash. Git stash documentation
3. Remove the clean worktree
After committing or stashing the changes you need, leave the target directory and run the removal command from another worktree in the same repository. Use the exact path reported by git worktree list:
cd "/path/to/main-repository"
git worktree remove "/path/to/finished-worktree"
git worktree list
The second list is a useful confirmation that Git no longer lists that checkout. Git documents that remove accepts only clean worktrees by default; an untracked file or a modification to a tracked file can prevent removal. Git worktree documentation
If removal reports that the worktree is not clean, do not switch to git worktree remove --force unless you have decided that every remaining local file can be discarded. Return to that worktree, inspect git status, and preserve the remaining files or changes first. In particular, stash does not include ignored files, and a submodule may have its own changes that need separate attention.
If you already deleted the folder in Finder
If you deleted a linked worktree directory outside Git, its administrative record may remain. From the main repository, run git worktree list and check whether the missing path is marked prunable. Git provides git worktree prune to remove records for worktrees whose directories are missing; it does not restore the deleted project files. Use it only after confirming the directory really is gone and you do not need its contents. For future cleanup, use git worktree remove so Git updates the worktree metadata as part of removal. Git worktree documentation
A safe cleanup ends with the finished checkout removed, any changes you meant to keep committed or stashed, and any ignored local files you needed preserved separately. Leave the worktree in place whenever you cannot verify that its remaining contents are expendable.