wf-prune

Prune local branches merged into the default branch via git and GitHub.

1|Updated Mar 16, 2026
One-click install
npx skills add https://github.com/andeart/dotfiles --skill wf-prune
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wf-prune
Source: https://github.com/andeart/dotfiles/tree/main/agents/skills/wf-prune
Command: npx skills add https://github.com/andeart/dotfiles --skill wf-prune

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Remove local branches that have been merged into the default branch, providing a clear, safe cleanup workflow to keep your repository tidy.

Core Features & Use Cases

  • Detect the repository default branch (main or master) and verify the current context.
  • Identify merged local branches via git ancestry or merged GitHub PRs, excluding the default.
  • Show a consolidated summary with PR links and remote status before asking for deletion confirmation.
  • Optional deletion of confirmed branches with a safety guard against accidental removal.

Quick Start

Tell the assistant to prune merged branches, e.g., say "wf-prune" to start the cleanup.

Frequently Asked Questions about wf-prune

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

FAQPage Schema
How do I safely delete local git branches that have been merged?

Safely deleting merged local git branches requires fetching origin, listing branches via git ancestry or GitHub PRs, and confirming deletion through a consolidated summary. This prevents accidental removal of active branches.

What's the best way to clean up merged branches without deleting unmerged work?

The best way to clean up merged branches is to use a tool that cross-references git branch --merged with GitHub PR statuses and presents a summary before deletion. This explicitly excludes unmerged branches from the removal list.

Does this branch cleanup workflow support repositories using master instead of main?

Yes, this branch cleanup workflow supports repositories using master instead of main by automatically detecting the default branch. It verifies the current context before proceeding to list and prune merged local branches.

Can I use GitHub PR status to identify which local branches are merged?

Yes, you can use GitHub PR status to identify merged local branches by running gh pr list alongside git branch --merged. This combines local ancestry checks with remote PR verification for a consolidated summary.

Why should I fetch origin before pruning local merged branches?

You should fetch origin before pruning local merged branches to ensure your local repository has the latest remote tracking updates. This guarantees the merge status check against the default branch is accurate before deletion.