SpawnSweep

Clean up old Git worktrees on macOS

Run git worktree list from the repository to find linked checkouts left by AI coding agents. Before removing a worktree, check its branch and status, confirm that its work has been saved, and copy any ignored files you still need. Ignored files such as .env and local databases usually live only in that checkout.

Check the checkout before removing it

git worktree list
git -C "/path/to/worktree" status --short --ignored

Use the path reported by Git. In the status output, ?? marks untracked files and !! marks ignored files. Check for local edits, confirm the branch’s commits are where you want them, and save the ignored files you will need. If a dev server is running from the checkout, finish the session and stop its processes first.

When a linked worktree is clean and disposable, remove it with Git:

git worktree remove "/path/to/worktree"

If Git refuses, review the reason before proceeding. The command registers the removal with Git and leaves the branch in the repository. Git worktree documentation · Git status documentation

Slim a worktree or recycle it with SpawnSweep

Open Storage to see worktree status and size by repository.

Use Slim when you anticipate returning to a branch but want its dependencies off disk. Review the Recycle preview when the checkout has served its purpose. SpawnSweep cleanup rules

Can I remove a worktree after a squash merge?

Git may still report commits on the worktree branch that are absent from the destination branch after a squash merge. Check the merged pull request and compare the changes before deciding what to archive. Treat Git’s clean-worktree check and your merge review as separate checks.

SpawnSweep’s This Mac page with storage, memory and cleanup categories
The This Mac view shows where disk and memory are in use.
Download for Mac All Mac cleanup guides

Free, open-source app for macOS 14 or later on Apple silicon. Install details