branch-cleanup

Audit local git branches and pull requests to generate a safe cleanup plan.

Updated Jul 5, 2026
One-click install
npx skills add https://github.com/danwan/coding-agent --skill branch-cleanup-danwan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: branch-cleanup
Source: https://github.com/danwan/coding-agent/tree/main/sources/skills/branch-cleanup
Command: npx skills add https://github.com/danwan/coding-agent --skill branch-cleanup-danwan

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires git, gh, python3, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This skill solves the fragmentation of branch hygiene by orchestrating git and GitHub CLI tools into a safe, sequenced, and report-driven workflow that prevents manual errors and data loss.

Core Features & Use Cases

  • Automated Convergence: Safely merges or rebases stale branches against the default branch while preserving work.
  • Intelligent Cleanup: Automatically identifies and deletes merged, squashed, or stale branches with safety checks to prevent accidental deletion of unique work.
  • Use Case: Use this skill when a repository has accumulated dozens of stale branches and mixed-state PRs, and you need to restore a clean, manageable state without manually checking each branch's status.

Quick Start

Run the branch cleanup skill to audit the current repository and generate a safe execution plan for merging and deleting branches.

Frequently Asked Questions about branch-cleanup

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

FAQPage Schema
How do I clean up stale git branches and merge pull requests in bulk?

To clean up stale git branches and merge pull requests in bulk, you can orchestrate a multi-phase workflow that audits local branches and GitHub PRs, converging them onto a clean default branch with automated safety checks. This skill automates that exact convergence process.

What is the safest way to delete merged git branches without losing unique work?

The safest way to delete merged git branches without losing unique work is using a workflow with intelligent cleanup safety checks. This skill automatically identifies merged, squashed, or stale branches and requires explicit user approval before any destructive deletion occurs.

Do I need GitHub CLI installed to automate pull request merging?

Yes, you need GitHub CLI installed to automate pull request merging, along with git and python3. This skill depends on these three tools to orchestrate PR merging, branch hygiene, and stale branch deletion within a single repository.

How does rerere-based conflict resolution work during branch convergence?

Rerere-based conflict resolution works during branch convergence by remembering how you previously resolved a conflict and automatically applying the same resolution. This skill uses rerere to safely rebase or merge stale branches against the default branch while preserving work.

What is the best way to restore a clean repository state with mixed-state PRs?

The best way to restore a clean repository state with mixed-state PRs is an automated convergence workflow. This skill audits the repository, generates a safe execution plan, and orchestrates the merging of branches and PRs onto a clean default branch without manual checks.

Can I automate branch cleanup without risking accidental data loss?

You can automate branch cleanup without risking accidental data loss by using a workflow designed for non-destructive operations. This skill requires explicit user approval for all destructive actions and uses safety checks to prevent the deletion of branches containing unique work.