# Git Prune Branches Local

> Clean up local git branches that have been merged into main/master. Use when: (1) User says 'prune local branches' or 'clean local branches', (2) User wants to delete only local merged branches without touching remote.

- Skill: `takazudo/git-prune-branches-local` (Agent Skill)
- Install (CLI): `npx skillmds@latest add takazudo/git-prune-branches-local`
- Raw SKILL.md: https://api.skillmd.com/api/skills/takazudo/git-prune-branches-local/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: takazudo (https://skillmd.com/u/takazudo)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/takazudo/git-prune-branches-local

---


# Git Prune Branches (Local)

Check and prune local branches that have been merged:

1. Get the list of all local branches using `git branch`
2. For each branch, check if it has been merged into the main branch using `git branch --merged`
3. Exclude protected branches (main, master, develop, etc.)
4. Create a list of branches that are safe to delete
5. Present the deletion list to the user clearly
6. Ask for confirmation: "The following local branches will be deleted. Proceed? (yes/no)"
7. If user confirms with "yes" or similar affirmative response, delete the branches using `git branch -d <branch-name>` for each branch
8. Report the results

**Important:** Never delete:

- The currently checked out branch
- Protected branches: main, master, develop, development, staging, production
- Branches that are not fully merged (unless explicitly requested)

