git-cleanup

Categorize local git branches and worktrees into merged, squash-merged, superseded, or active work.

1|Updated Mar 27, 2026
One-click install
npx skills add https://github.com/gebl/anvil-skill-marketplace --skill git-cleanup-gebl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-cleanup
Source: https://github.com/gebl/anvil-skill-marketplace/tree/main/generated/copilot/skills/git-cleanup
Command: npx skills add https://github.com/gebl/anvil-skill-marketplace --skill git-cleanup-gebl

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Automates safe cleanup of local git branches and worktrees by categorizing them into merged, squash-merged, superseded, or active work.

Core Features & Use Cases

  • Safety-first workflow with explicit user confirmations before any destructive action.
  • Automatic categorization of branches and worktrees into merged, squash-merged, superseded, or active work.
  • Respect protected branches (e.g., main, master, develop, release/*) and present clear deletion commands for review.
  • Use case: after PRs are merged, quickly prune stale branches to keep the repo clean.

Quick Start

Run the git-cleanup workflow and confirm each deletion before proceeding.

Frequently Asked Questions about git-cleanup

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

FAQPage Schema
How do I safely delete local git branches after merging a PR?

To safely delete local git branches after merging, the workflow categorizes branches into merged, squash-merged, superseded, or active work, requiring explicit user confirmation before executing any destructive deletion commands.

What is the safest way to clean up stale git worktrees in a local repository?

The safest way to clean up stale git worktrees is using a gated workflow that automatically categorizes them by status and requires explicit user confirmation before removing any worktrees, ensuring active work is preserved.

Can I delete squash-merged git branches without accidentally removing active work?

Yes, you can delete squash-merged git branches safely because the workflow distinguishes between squash-merged, superseded, and active work, presenting clear deletion commands for review while requiring confirmation to protect ongoing development.

Does git branch cleanup protect main and release branches from accidental deletion?

Git branch cleanup protects main and release branches by respecting protected branches like main, master, develop, and release/*, preventing accidental deletion while categorizing other local branches for safe removal.

What's the best way to automate local branch deletion without affecting remote repositories?

The best way to automate local branch deletion without remote impact is using a safety-first workflow that categorizes branches locally and avoids touching remote state entirely unless explicitly requested by the user.