git-cleanup

Categorize local git branches and worktrees by merge status for deletion.

1|Updated Feb 17, 2026
One-click install
npx skills add https://github.com/Ramprasad4121/srp --skill git-cleanup-ramprasad4121
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-cleanup
Source: https://github.com/Ramprasad4121/srp/tree/main/skills-repos/trailofbits/plugins/git-cleanup/skills/git-cleanup
Command: npx skills add https://github.com/Ramprasad4121/srp --skill git-cleanup-ramprasad4121

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps you safely manage and clean up local Git branches and worktrees that have become accumulated over time, preventing clutter and confusion.

Core Features & Use Cases

  • Categorizes Branches: Identifies branches as merged, squash-merged, superseded, or active work.
  • Safe Deletion Workflow: Ensures no data is lost by requiring explicit user confirmation at multiple stages.
  • Handles Complex Cases: Differentiates between safe deletions (-d) and force deletions (-D) for squash-merged branches.
  • Groups Related Branches: Analyzes and presents branches with shared prefixes as a single unit.
  • Detects Dirty Worktrees: Warns about uncommitted changes before potential worktree removal.

Quick Start

Use the git-cleanup skill to analyze and suggest local git branches for deletion.

Frequently Asked Questions about git-cleanup

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

FAQPage Schema
How do I safely clean up local git branches after merging?

To safely clean up local git branches, this Skill categorizes them by merge status and relationship to remote branches, requiring explicit user confirmation before executing any deletions to prevent data loss. It distinguishes between safe deletes for merged branches and force deletes for squash-merged ones.

What is the best way to delete squash-merged git branches without losing data?

Deleting squash-merged git branches safely requires distinguishing between safe deletes and force deletes. This Skill identifies squash-merged branches and uses a multi-stage confirmation process before executing force deletions, ensuring you don't lose active work.

How does git branch cleanup handle uncommitted changes in dirty worktrees?

Git branch cleanup handles dirty worktrees by detecting uncommitted changes and warning you before any potential worktree removal. This prevents accidental data loss by requiring explicit confirmation during the multi-stage deletion workflow.

Can I group related git branches with shared prefixes for bulk deletion?

Yes, you can group related git branches for analysis. This Skill analyzes and presents branches with shared prefixes as a single unit, allowing you to manage and delete related local branches together during the confirmation workflow.

Does this git branch cleanup tool protect main or other protected branches from deletion?

Yes, this git branch cleanup tool handles protected branches explicitly. It analyzes your local branches and prevents the deletion of protected branches, ensuring only safe candidates are presented for your confirmation during the cleanup process.