clean-branches

Remove local and fork branches merged into main, including squash merges.

34|71|Updated Jan 27, 2026
One-click install
npx skills add https://github.com/hw-native-sys/simpler --skill clean-branches-hw-native-sys
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-branches
Source: https://github.com/hw-native-sys/simpler/tree/main/.claude/skills/clean-branches
Command: npx skills add https://github.com/hw-native-sys/simpler --skill clean-branches-hw-native-sys

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Remove stale local and remote git branches that have been merged into main. Detects regular merges and squash merges. Cleans up fork remote branches and prunes tracking refs. Use when the user asks to clean up branches, remove merged branches, or tidy up git.

Core Features & Use Cases

  • Detects local merged branches (including squash-merged) and safe to delete.
  • Cleans fork remote branches and prunes tracking refs without touching upstream or main.
  • Supports an approval workflow to confirm deletions.

Quick Start

Run the skill in your repository to automatically remove branches that have been merged into main, both locally and on your fork, while never touching upstream or main.

Frequently Asked Questions about clean-branches

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I delete git branches that have been merged into main?

To delete git branches merged into main, you need a cleanup process that identifies merged work and removes those branches locally and remotely. This skill detects regular and squash merges, safely deleting stale branches while protecting upstream and main.

Can I detect and remove squash-merged branches in git?

Yes, you can detect and remove squash-merged branches by checking if the branch's commits are already in main. This skill identifies squash-merged branches locally and on forks, pruning tracking refs and deleting them safely without touching upstream or main.

How do I clean up fork remote branches without affecting upstream?

To clean up fork remote branches without affecting upstream, you must target only fork-specific remotes and skip upstream or main branches. This skill handles fork-only deletion, prunes tracking refs, and enforces safeguards against touching upstream or main branches.

What is the best way to prune stale git branches after a merge?

The best way to prune stale git branches after a merge is to use an automated cleanup workflow that detects merged work and prompts for approval. This skill identifies merged branches locally and on forks, offering optional user approval before deletion.

Does git branch cleanup work for both individual developers and teams?

Yes, git branch cleanup works for both individual developers and teams managing repositories. This skill is applicable to any repository context, identifying and removing merged branches locally and on forks while safeguarding upstream and main.