branch-cleanup

Automates Git branch cleanup and synchronization with the main branch after merges.

1|Updated May 30, 2025
One-click install
npx skills add https://github.com/pkuppens/on_prem_rag --skill branch-cleanup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: branch-cleanup
Source: https://github.com/pkuppens/on_prem_rag/tree/main/.claude/skills/branch-cleanup
Command: npx skills add https://github.com/pkuppens/on_prem_rag --skill branch-cleanup

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps maintain a clean local Git repository by automatically removing branches that have already been merged into the main branch, reducing clutter and preventing confusion.

Core Features & Use Cases

  • Sync Local Branches: Updates your local main branch and removes outdated local branches.
  • Handles Merge Types: Supports cleanup after merge, squash-merge, and rebase-merge operations.
  • Use Case: After merging a feature branch into main, run this skill to automatically delete the now-redundant feature branch locally.

Quick Start

Run the branch-cleanup skill to synchronize your local branches with the main branch.

Frequently Asked Questions about branch-cleanup

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

FAQPage Schema
How do I automatically delete local git branches after a pull request is merged?

To delete local git branches after a merge, this skill checks out the main branch, pulls the latest changes, prunes stale remote-tracking branches, and deletes local branches whose content is already integrated into main.

What is the best way to clean up stale git branches in my local repository?

To clean up stale git branches, this skill automates synchronizing local branches with the main branch, prunes stale remote-tracking branches, and deletes local branches already merged into main to reduce repository clutter.

Does branch cleanup support squash-merge and rebase-merge operations?

Yes, this branch cleanup skill supports cleanup after standard merge, squash-merge, and rebase-merge operations, identifying and removing local branches whose content is already integrated into main.

How do I sync local branches with the main branch after merging?

You can sync local branches with the main branch by running this skill, which checks out main, pulls the latest changes, prunes stale remote-tracking branches, and deletes integrated local branches to keep your repository up-to-date.

Why do I need to prune stale remote-tracking branches during git cleanup?

Pruning stale remote-tracking branches during git cleanup removes outdated references to deleted remote branches, preventing confusion and ensuring your local repository accurately reflects the current remote state.