gmc
Worktree

Prune

Remove worktrees whose branches are merged.

gmc wt prune removes worktrees whose branches are already merged into the base branch.

Usage

gmc wt prune

Preview

gmc wt prune --dry-run

PR-aware cleanup

gmc wt prune --pr-aware

Stale local branches

Merged branches that no longer have a worktree are left alone by default. Add --branches to delete them as well; combine with --pr-aware when the repository uses squash merges, since ancestry checks cannot see those.

gmc wt prune --branches --pr-aware --dry-run
gmc wt prune --branches --pr-aware

Use gmc wt prune --all --pr-aware --dry-run to preview cleanup across repositories with linked worktrees in the home directory.

Base branch

gmc wt prune -b main

Notes

Use --force only when you accept losing dirty worktree changes.

On this page