git-cleanup

Automate safe cleanup of stale git branches and unused worktrees.

2|Updated Feb 17, 2026
One-click install
npx skills add https://github.com/mostafa-drz/claude-skills --skill git-cleanup-mostafa-drz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-cleanup
Source: https://github.com/mostafa-drz/claude-skills/tree/main/code/git-cleanup
Command: npx skills add https://github.com/mostafa-drz/claude-skills --skill git-cleanup-mostafa-drz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Identifies and removes stale git branches, orphaned remote branches, and unused worktrees. Cross-references with Linear (or other integrations) to check issue status before deleting. Use when your repos have accumulated stale branches and you want to tidy up.

Core Features & Use Cases

  • Smart, context-aware detection of repositories and scope (local/remote/worktrees) with interactive prompts
  • Linear integration for ticket-status aware cleanup
  • Dry-run previews and safe deletion guards to prevent accidental data loss

Quick Start

Run /git-cleanup to auto-detect repos and perform a guarded cleanup of stale branches.

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 stale git branches across multiple repositories?

To safely clean up stale git branches across multiple repositories, you can use automated cleanup tools that auto-detect repositories, provide dry-run previews, and apply deletion guards to prevent data loss.

Can I check Linear ticket status before deleting a git branch?

Yes, you can check Linear ticket status before deleting a git branch. The cleanup process cross-references branches with Linear issue statuses via provided MCP tools to ensure tickets are resolved before removal.

What is the best way to remove unused git worktrees and orphaned remote branches?

The best way to remove unused git worktrees and orphaned remote branches is using an automated tool that applies context-aware detection and interactive prompts to safely prune local and remote scopes.

Does git branch cleanup support dry-run previews?

Yes, git branch cleanup supports dry-run previews. This feature allows you to see exactly which stale branches and worktrees will be removed before any actual deletion occurs, preventing accidental data loss.

How do I prevent deleting protected branches during automated git cleanup?

To prevent deleting protected branches during automated git cleanup, the process implements guardrails through protected branch configurations and user prompts, ensuring critical branches are never removed.