git-cleanup

Categorize local git branches and worktrees for safe deletion.

6.5k|561|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/trailofbits/skills --skill git-cleanup-trailofbits
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-cleanup
Source: https://github.com/trailofbits/skills/tree/main/plugins/git-cleanup/skills/git-cleanup
Command: npx skills add https://github.com/trailofbits/skills --skill git-cleanup-trailofbits

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Manages and organizes local git branches and worktrees, safely cleaning up unnecessary branches, and helping to keep the local git workspace clutter-free and well-maintained.

Core Features & Use Cases

  • Branch Categorization: Automatically categorizes local git branches and worktrees as merged, squash-merged, superseded, or active work.
  • Branch Deletion: Provides safe, user-confirmed deletion of unnecessary branches, ensuring data integrity.
  • Worktree Management: Includes features for identifying and cleaning up git worktrees that are no longer needed.

Quick Start

To begin the cleanup process, simply run 'git-cleanup'. It will prompt you for user confirmations to delete any unnecessary branches.

Frequently Asked Questions about git-cleanup

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

FAQPage Schema
How do I clean up local git branches and worktrees?

To clean up local git branches, run git-cleanup to automatically categorize branches and worktrees as merged, squash-merged, superseded, or active. It then prompts for user confirmation before safely deleting unnecessary branches to maintain a clutter-free workspace.

How does git categorize merged and squash-merged branches for deletion?

Git-cleanup categorizes branches by checking merge status using git commands, identifying branches as merged, squash-merged, superseded, or active work. This analysis ensures safe deletion by distinguishing fully integrated branches from those still containing unmerged changes.

Can I use git-cleanup to manage git worktrees that are no longer needed?

Yes, you can use git-cleanup to manage git worktrees by identifying and cleaning up worktrees that are no longer needed. It categorizes active worktrees and prompts for user confirmation before safely removing obsolete worktrees.

Do I need Bash and Grep installed to run git branch cleanup?

Yes, you need Bash and Grep installed to run git branch cleanup because the categorization and deletion logic relies on these shell utilities. Git is also required as a core dependency to execute the underlying repository commands.

What is the best way to safely delete git branches without losing active work?

The best way to safely delete git branches is using a tool that categorizes them by merge status and requires user confirmation before deletion. Git-cleanup analyzes branches to prevent accidental loss of active or superseded work.

Why does git-cleanup prompt for confirmation during branch deletion?

Git-cleanup prompts for confirmation during branch deletion to ensure data integrity and prevent accidental loss of work. This user interaction step verifies that only categorized unnecessary branches and worktrees are permanently removed from the local repository.