Bulk cleanup of git worktrees and merged branches across multiple repositories.
- Worktree cleanup — Detect and remove worktrees that are fully merged into main with no uncommitted changes
- Branch cleanup — Delete local branches that are fully merged into main/master
- Safe by default — Dry-run mode shows what would be deleted before executing
- Multi-repo scan — Scan an entire directory of git repositories at once
cargo install git-cleaner# Scan and report all cleanable items
git-cleaner scan ~/projects
# Worktree cleanup (dry-run)
git-cleaner worktrees ~/projects
# Worktree cleanup (execute)
git-cleaner worktrees ~/projects --execute
# Branch cleanup (dry-run)
git-cleaner branches ~/projects
# Branch cleanup (execute)
git-cleaner branches ~/projects --execute
# Clean both worktrees and branches
git-cleaner all ~/projects --executeScanning 125 repositories in /home/user/projects
arch-lint
[DELETE] arch-lint-ts (feature/tree-sitter)
[KEEP] arch-lint-global-config (feature/global-config) — 1 unmerged commits, uncommitted changes
4 merged branches: feat/no-silent-result-drop, feature/global-config-v2, ...
--- Summary ---
Worktrees: 57 total, 28 removable
Merged branches: 537
- Worktrees are only removed when:
- All commits are merged into main/master
- No uncommitted changes exist
- Branches are only deleted when fully merged (
git branch -dequivalent) --executeflag is required for any destructive action- Interactive confirmation before execution
MIT