# Branches Cleanup

> Automatically clean up local git branches that have been merged into the base branch Use when this capability is needed.

- Skill: `tomevault-io/branches-cleanup` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/branches-cleanup`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/branches-cleanup/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/branches-cleanup

---


# Cleanup Merged Branches

Automatically clean up local git branches that have been merged into the base branch.

## Instructions

When this skill is invoked manually, clean up merged branches:

1. Run `git branch --merged <base-branch>` to find branches merged into the base branch
2. Exclude protected branches: `develop`, `main`, `master`
3. For each merged branch found:
   - Check if it has an associated worktree with `git worktree list`
   - If worktree exists, remove it with `git worktree remove <path>`
   - Delete the local branch with `git branch -d <branch>`
4. Report what was cleaned up

## Protected Branches (NEVER delete)
- `develop`
- `main`
- `master`

## Automation

This skill automatically runs after `git pull` via the PostToolUse hook in `.claude/settings.json`.

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/nathanchase) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-14 -->

