git-cleanup

Audit and remove stale git worktrees and branches merged into dev.

1|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/aberrantCode/llm_skills --skill git-cleanup-aberrantcode
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-cleanup
Source: https://github.com/aberrantCode/llm_skills/tree/main/claude/skills/git-cleanup
Command: npx skills add https://github.com/aberrantCode/llm_skills --skill git-cleanup-aberrantcode

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill tackles Git repository clutter by automatically identifying and removing branches and worktrees that are no longer needed after merging into the dev branch, preventing bloat and maintaining a clean workflow.

Core Features & Use Cases

  • Stale Detection: Audits worktrees, local branches, and remote origin branches to find those fully merged into dev, supporting both standard and squash merge strategies.
  • Safe Cleanup: Checks for uncommitted changes to avoid data loss, presents a summary for user confirmation, and executes deletions only on approved clean items.
  • Use Case: After completing several feature branches and merging them to dev, invoke this Skill to quickly remove the obsolete ones, keeping your repo organized for the next sprint.

Quick Start

Activate the git-cleanup skill to identify and delete all stale branches and worktrees merged into dev.

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 stale git branches and worktrees after merging to dev?

To clean up stale git branches and worktrees, the skill audits repositories using dev as the integration branch to find items merged via standard or squash strategies, then performs user-confirmed safe deletions. It checks for uncommitted changes to prevent data loss.

Does git branch cleanup work with squash merge strategies?

Yes, git branch cleanup works with squash merge strategies. The skill audits local and remote origin branches to detect those fully merged into dev, handling both standard and squash merge tracking for accurate stale branch identification.

How does stale worktree detection prevent data loss during deletion?

Stale worktree detection prevents data loss by checking for uncommitted changes and dirty worktree states before any action. It presents a summary of merged items for user confirmation, executing deletions only on approved clean branches and worktrees.

What is the best way to remove obsolete remote origin branches after a sprint?

The best way to remove obsolete remote origin branches is fetching remote state to verify merge status into dev. The skill audits origin branches, confirms safe deletion with the user, removes stale items, and appends results to a cleanup log file.

Can I automate post-merge housekeeping for local git branches?

You can automate post-merge housekeeping by invoking the skill to audit local branches against the dev branch. It identifies fully merged local branches, checks for dirty worktrees, and executes safe deletions after user confirmation to maintain repo hygiene.

What are the limitations of automated git cleanup for dev branch workflows?

A limitation of automated git cleanup is its specific requirement for repositories using dev as the integration branch. It relies on git commands for fetching remote state and merge status checks, requiring user confirmation to safely delete only clean, merged items.