cleanup-branches

Automate cleanup of stale local Git branches and orphaned worktrees.

4|1|Updated Mar 14, 2026
One-click install
npx skills add https://github.com/MattVOLTA/outworkos_diy --skill cleanup-branches-mattvolta
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cleanup-branches
Source: https://github.com/MattVOLTA/outworkos_diy/tree/main/skills/cleanup-branches
Command: npx skills add https://github.com/MattVOLTA/outworkos_diy --skill cleanup-branches-mattvolta

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Remove stale local branches and orphaned worktrees to keep repositories clean and navigable, reducing confusion and accidental checkouts.

Core Features & Use Cases

  • Detects and remove branches that are merged or abandoned, while preserving main and branches with open or merged PRs.
  • Cleans up orphaned worktrees and prunes remote refs to reflect the true repository state.
  • Provides a transparent plan with safety rules and a clear summary report after execution.

Quick Start

Run the cleanup operation in your repository to automatically prune merged branches and stale worktrees.

Frequently Asked Questions about cleanup-branches

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

FAQPage Schema
How do I clean up stale local Git branches safely?

To clean up stale Git branches safely, you can automate the removal of merged or abandoned branches while enforcing safety checks that preserve main and any branches with open or merged pull requests. This provides a transparent plan and summary report after execution.

What is the best way to remove orphaned Git worktrees?

Removing orphaned Git worktrees is best handled by automating their cleanup alongside stale local branches. This process prunes remote refs to reflect the true repository state, keeping your workspace navigable and reducing accidental checkouts of abandoned work.

Does branch cleanup preserve branches with open pull requests?

Yes, branch cleanup preserves branches with open pull requests. The automated process enforces safety rules that specifically target merged or abandoned branches while safeguarding your main branch and any local or remote branches associated with open or merged PRs.

How do I prune remote refs and delete abandoned branches in Git?

You can prune remote refs and delete abandoned Git branches by running an automated cleanup operation. It targets stale local branches and orphaned worktrees across local and remote state, providing a step-by-step procedure with verifications to ensure safe repository maintenance.

When should I automate Git branch cleanup in my DevOps workflow?

You should automate Git branch cleanup in your DevOps workflow when repository navigation becomes confusing due to accumulated stale branches and orphaned worktrees. Automating this maintenance removes merged or abandoned branches safely, keeping your repository clean and navigable.