prune-merged

Deletes merged local and remote Git branches with tombstone-based recovery.

3|Updated Apr 11, 2026
One-click install
npx skills add https://github.com/bravros/bravros --skill prune-merged-bravros
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: prune-merged
Source: https://github.com/bravros/bravros/tree/main/plugins/core/skills/prune-merged
Command: npx skills add https://github.com/bravros/bravros --skill prune-merged-bravros

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Repositories accumulate stale branches after pull requests merge, cluttering branch lists and making it hard to see active work. Manually deleting them risks losing unmerged work or branches checked out in active worktrees. ## Core Features & Use Cases - Dual-signal merge detection: Confirms a branch is merged via git ancestry or a verified merged pull request, covering squash-merge workflows where ancestry checks fail. - Five safety guards: Skips protected branches, GitHub-protected branches, the current HEAD, branches referenced by open plans, and branches checked out in any worktree. - Recoverable deletion: Writes 7-day tombstone refs before deleting, so pruned branches can be restored with a single git update-ref command. - Use Case: After a sprint, run a dry-run to list every branch merged into main, review the candidates including rejected-PR branches, then apply the prune to clean both local and remote refs with a full audit log. ## Quick Start Ask the agent to run /prune-merged to list merged branch candidates, review the dry-run output, and confirm deletion.

Frequently Asked Questions about prune-merged

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely delete merged Git branches locally and remotely?▼

Run a dry-run first to list merged branch candidates with source attribution, review the output, then apply the deletion. Each deleted branch gets a 7-day tombstone ref so it can be restored with git update-ref if needed.

How to clean up branches after squash merging pull requests?▼

Squash-merged branches fail git ancestry checks because their tip is never an ancestor of base. This workflow adds a second signal: a merged PR whose merge_commit_sha is verified as an ancestor of base, so squash-merged branches are correctly detected.

Can I recover a branch after it was pruned?▼

Yes, within 7 days. Each pruned branch writes a tombstone ref like refs/tombstones/feat-foo, and you restore it with git update-ref pointing the branch name at the tombstone. After 7 days, recovery relies on the git reflog.

Why is a merged branch skipped during branch pruning?▼

Branches are skipped when they match protected names, have GitHub branch protection, are the current HEAD, are referenced by an open plan file, or are checked out in any worktree. Worktree-active branches are always skipped, even when fully merged.

Does branch pruning delete branches with closed unmerged pull requests?▼

Yes, by default. A branch whose every PR is closed with none merged is classified as rejected and deleted under the same user approval step. Pass the exclude-rejected flag to hold those branches back.