git-branch-cleanup

Installation
SKILL.md

Git Branch Cleanup

Use this skill to safely remove merged or stale branches with explicit user confirmation.

Safety Rules

  • Stop if the working tree is not clean.
  • Detect the default branch from origin/HEAD and fall back to main, then master.
  • Never delete protected branches.
  • Never force delete unless the user explicitly approves.

Workflow

  1. Check repository state

    • git status --porcelain
    • If not clean, ask the user to commit or stash first.
  2. Detect default branch

    • git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'
Related skills
Installs
6
Repository
tmeister/skills
First Seen
Feb 3, 2026