Prune Stale Branches And Worktrees — Git skill for Claude Code
Prune stale git branches (merged, abandoned, or older than 30 days with no open PR) and stale git worktrees.
How to install Prune Stale Branches And Worktrees
Installs to ~/.claude/skills/macanderson-agent-harness-prune-stale-branches-and-worktrees/SKILL.md
mkdir -p ~/.claude/skills/macanderson-agent-harness-prune-stale-branches-and-worktrees && curl -fsSL https://raw.githubusercontent.com/macanderson/agent-harness/HEAD/commands/prune-stale-branches-and-worktrees.md -o ~/.claude/skills/macanderson-agent-harness-prune-stale-branches-and-worktrees/SKILL.md Restart Claude Code, or start a new session, for it to be picked up.
What Prune Stale Branches And Worktrees does
description: Prune stale git branches (merged, abandoned, or older than 30 days with no open PR) and stale git worktrees. Shows a plan, confirms, then executes. allowed-tools: Bash, Read, Agent, TodoWrite, ToolSearch, mcp__plugin_github_github__list_pull_requests, mcp__plugin_github_github__list_branches
/prune-stale-branches-and-worktrees
Clean up stale git branches (local + remote) and git worktrees. Always show the plan before deleting anything. Never delete `main`, `develop`, or
Alternatives in Git
- 使用 Git Worktrees — 创建孤立的 Git worktrees,带有智能目录选择与安全验证 115.1k ★
- Clean Worktrees (Automatic) — Automatically remove all worktrees for branches merged into master 25.5k ★
- OSS PR — Commit + PR workflow for open source contributions: auto-creates a user-prefixed branch when on main/master, t 19.7k ★
Full documentation available on GitHub
View Source RepositoryRelated Skills
Clean Branches
Safely prune merged and stale Git branches: drop dead remote-tracking refs, list merged candidates for review,
Create Worktrees
by evmts - Creates git worktrees for all open PRs or specific branches, handling branches with slashes, cleani
Branch Cleanup
Clean up merged, stale, and orphaned git branches. Protects main/develop/release/ automatically. Supports --dr
Prune Worktrees
Remove git worktrees whose PR has merged, to recover disk (dry-run first)
Mise Clean
Sweep the project for hygiene cruft — junk tracked in git, backup/scratch files, stale branches and orphaned w
Clean Garden
Prune merged-PR worktrees and (optionally) create a new one in the same shot
Related Agents
Branch Janitor
Post-merge cleanup agent — after the human confirms a PR/branch merge, removes stale agent worktrees, deletes
Branch Hygiene
MUST be used whenever the user asks to find stale, merged, or orphaned git branches, or asks to review/clean u
Org Branch Sweep
Bird's-eye view of work pending merge across the organization's repositories — which branches carry which Jira