florianbruniaux/claude-code-ultimate-guide/git-worktree-clean
Claude Code and agent skill by florianbruniaux/claude-code-ultimate-guide
- community
Checking that the SKILL.md file is still in the repository.
Clean up stale git worktrees with merged branch detection and disk usage report
Install
npx vskill@latest install florianbruniaux/claude-code-ultimate-guide/git-worktree-cleanSKILL.md
Git worktree clean
Batch cleanup of stale git worktrees. Safely removes merged branches, reports disk usage, and handles unmerged branches interactively.
Core principle: Auto-clean merged worktrees, interactive review for unmerged, always report what was reclaimed.
Part of: Worktree Lifecycle Suite | `/git-worktree` | `/git-worktree-status` | `/git-worktree-remove`
Process
- List All Worktrees:
git worktree list - Classify Each: merged vs unmerged vs protected
- Calculate Disk Usage: Per-worktree size
- Auto Mode: Remove all merged worktrees (safe)
- Interactive Mode: Review unmerged worktrees one by one
- Database Cleanup Reminder: List DB branches to clean
- Report: Summary of actions taken and space reclaimed
Flags
| Flag | Effect | |
|---|---|---|
--dry-run | Preview what would be cleaned, no changes | |
--all | Include unmerged worktrees (interactive confirmation each) | |
--force | Remove all worktrees without confirmation (dangerous) |
Worktree discovery
Classification
Disk usage calculation
Dry run mode
Auto mode (default)
Only removes merged worktrees. Safe by default.
Interactive Mode (--all)
Reviews unmerged worktrees one by one:
Report format
After cleanup:
Dry run report:
Quick reference
| Situation | Action | |
|---|---|---|
| Default (no flags) | Remove merged worktrees only | |
--dry-run | Preview without changes | |
--all | Merged (auto) + unmerged (interactive) | |
--force | Remove everything except protected | |
| Protected branch | Always kept | |
| Merged branch | Auto-removed | |
| Unmerged branch | Kept (default) or interactive (--all) | |
| DB branches detected | Reminder with exact commands |
Common mistakes
Running `--force` without `--dry-run` first
- Always preview with
--dry-runbefore force-cleaning
Forgetting DB branch cleanup
- Worktree cleanup doesn't auto-delete DB branches. Follow the reminder commands.
Not running cleanup regularly
- Stale worktrees accumulate disk space. Run
/git-worktree-clean --dry-runweekly.
Usage
Flags: $ARGUMENTS
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingexamples/skills/git-worktree-clean/SKILL.md
Popularity
- Repository stars
- 6,157
- Repository forks
- 809
- 7-day trend score
- 44
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 22 Sep 2026, a month ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/florianbruniaux/claude-code-ultimate-guide/git-worktree-clean)