cleanup-local-branches

Identify and delete stale or orphaned local Git branches with safety checks.

Updated Jan 6, 2023
One-click install
npx skills add https://github.com/pekral/phpstan-rules --skill cleanup-local-branches
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cleanup-local-branches
Source: https://github.com/pekral/phpstan-rules/tree/main/.claude/skills/cleanup-local-branches
Command: npx skills add https://github.com/pekral/phpstan-rules --skill cleanup-local-branches

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the accumulation of stale and orphaned local Git branches that clutter your workspace after pull requests are merged or abandoned.

Core Features & Use Cases

  • Intelligent Pruning: Identifies branches that are gone from the remote origin or have been inactive for over six months.
  • Safety First: Protects your current branch, default branches, and active work while providing a full preview before any deletion occurs.
  • Use Case: After a long-running project where dozens of feature branches were created and merged, use this skill to safely clean up your local environment without accidentally deleting unmerged work.

Quick Start

Run the cleanup-local-branches skill to identify and remove all stale or gone local branches from the current repository.

Frequently Asked Questions about cleanup-local-branches

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

FAQPage Schema
How do I automatically delete stale local Git branches?

Automatically delete stale local Git branches by running a cleanup workflow that checks remote tracking status and inactivity thresholds, removing branches gone from the remote origin or inactive for over six months.

How does Git branch pruning identify orphaned local branches?

Git branch pruning identifies orphaned local branches by checking remote tracking status against the origin repository and applying inactivity thresholds to flag branches no longer existing remotely or inactive for over six months.

Can I safely clean up local Git branches without losing unmerged work?

Yes, you can safely clean up local Git branches without losing unmerged work using safety-checked deletion that performs patch-identity verification and provides a full preview before any deletion occurs.

What is the best way to prune dead Git branches after merging pull requests?

The best way to prune dead Git branches after merging pull requests is to automate identification and deletion of orphaned local branches using remote tracking status and inactivity thresholds with safety-checked deletions.

Do I need git CLI access to automate local branch cleanup?

Yes, you need git CLI access to automate local branch cleanup because the pruning workflow uses git commands to verify remote tracking status and perform safety-checked deletions using patch-identity verification.

What limitations exist when pruning inactive Git branches automatically?

Limitations when pruning inactive Git branches automatically include protection of your current branch, default branches, and active work, meaning the workflow will not delete branches currently checked out or serving as the repository default.