Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Git Branch Cleanup: Find Stale and Merged Branches

    by Saizul Amin

    1

    This skill gives your agent a proven procedure plus scripts that check the facts, so you get the same correct answer every time, with exact fixes instead of vague advice.

    Free

    Security scanned
    Git Branch Cleanup: Find Stale and Merged Branches

    Git Branch Cleanup: Find Stale and Merged Branches

    Example session with this skill installed

    Run the Git Branch Cleanup skill on my project and give me a prioritised list of what to fix, with exact changes.

    • Read your context and instructions
    • Compiled the git branch cleanup

    Here is what the Git Branch Cleanup: Find Stale and Merged Branches skill produced.

    Demo: real, unedited output of the skill's bundled script on a sample input from its test suite.

    Output

    Base: main   (dry run - nothing was deleted)
    
    Local branches:
      merged       feature/merged                             331d  +0/-3  fully merged into main
      patch-merged feature/picked                             331d  +1/-2  all 1 commit(s) already in main as patches
      gone         feature/gone                               331d  +1/-0  upstream origin/feature/gone deleted; 1 unmerged commit(s)
      stale        spike/old                                 2523d  +1/-0  last commit 2523 days ago; 1 unmerged commit(s)
      current      feature/active                             331d  +1/-0  checked out here
      worktree     feature/wt                                   0d  +0/-0  checked out in another worktree
      protected    main                                         0d  +0/-0  protected name
      protected    release/1.0                                  0d  +0/-0  protected name
    
    Suggested commands (review, then run yourself):
      git fetch --prune   # refresh remote-tracking branches first
    
      # fully merged: safe, git refuses if not merged
      git branch -d feature/merged
    
      # feature/picked: all 1 commit(s) already in main as patches - review first: git log --oneline feature/picked --not <base>
      # git tag archive/feature/picked feature/picked && git branch -D feature/picked
      # feature/gone: upstream origin/feature/gone deleted; 1 unmerged commit(s) - review first: git log --oneline feature/gone --not <base>
      # git tag archive/feature/gone feature/gone && git branch -D feature/gone
      # spike/old: last commit 2523 days ago; 1 unmerged commit(s) - review first: git log --oneline spike/old --not <base>
      # git tag archive/spike/old spike/old && git branch -D spike/old
    

    What you do next

    1. Fix the highest-severity items first.
    2. Ask your agent to apply the fixes it suggests, then run the skill again to confirm.
    3. Keep the skill installed and re-run it whenever the project changes.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Clean up local and remote git branches safely with a dry-run report - branches fully merged into main, branches whose commits were rebased or cherry-picked in (patch-merged), branches whose upstream is gone after a squash merge, and stale unmerged branches older than N days, with ahead/behind counts. Protects main/master/develop/release/*, the current branch and other worktrees, and prints the exact git branch -d / -D and git push --delete commands with archive tags instead of deleting anything.

    Who it's for

    Use when the user has too many branches, asks to delete merged or old branches, prune "gone" branches, tidy git branch output, or clean up remote branches.

    What's inside

    • Tested, offline Python script(s): branch_report.py (deterministic results, standard library only unless noted)
    • Reference guides: recipes.md
    • Step-by-step agent instructions in SKILL.md covering: When to use; When not to use; Workflow

    Why it's worth it

    Generic prompts guess. This skill gives your agent a proven procedure plus scripts that check the facts, so you get the same correct answer every time, with exact fixes instead of vague advice. See the real demo below.

    Works with every major AI agent

    Built on the open SKILL.md standard: Claude Code, Codex CLI, Cursor, VS Code Copilot, Gemini CLI, Windsurf and 20+ other agents.

    Requirements

    • Python 3.8+ for the bundled scripts
    • No API keys, no account, runs locally

    Open source: saizul/git-workflow-skills on GitHub (MIT licence, by Saizul Amin).

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse All Claude Skills.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Frequently Asked Questions

    Clean up local and remote git branches safely with a dry-run report - branches fully merged into main, branches whose commits were rebased or cherry-picked in (patch-merged), branches whose upstream is gone after a squash merge, and stale unmerged branches older than N days, with ahead/behind cou...

    This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

    Connect your AI agent to Agensi through MCP, then ask it to use Git Branch Cleanup: Find Stale and Merged Branches on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

    Free