pr-cleanup

Automate safe local Git branch cleanup after PR merges.

415|44|Updated Mar 18, 2026
One-click install
npx skills add https://github.com/notque/claude-code-toolkit --skill pr-cleanup-notque
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pr-cleanup
Source: https://github.com/notque/claude-code-toolkit/tree/main/skills/pr-cleanup
Command: npx skills add https://github.com/notque/claude-code-toolkit --skill pr-cleanup-notque

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers clean up local Git branches after a PR has been merged, preventing clutter and reducing confusion.

Core Features & Use Cases

  • Identify the target branch to delete (current or named).
  • Switch to the main branch and pull latest changes.
  • Delete the local branch safely with -d, with fallback -D if appropriate, and prune remote refs.
  • Optional batch cleanup (--all) to remove all merged branches.
  • Report outcomes and remaining branches to provide full visibility.

Quick Start

Clean up the current local branch after a merge by switching to the main branch, deleting the target branch safely, pruning remotes, and reporting the results.

Frequently Asked Questions about pr-cleanup

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

FAQPage Schema
How do I clean up local Git branches after a PR merge?▼

Automated local Git branch cleanup after a PR merge switches to the main branch, pulls latest changes, safely deletes the target branch with -d, prunes remote refs, and reports the results.

What is the best way to delete all merged local branches in Git?▼

Deleting all merged local branches is best handled using an optional batch cleanup mode (--all) that removes all merged branches, prunes origin remotes, and reports what was deleted and what remains.

Can I detect and clean up squash-merged Git branches locally?▼

Yes, you can detect squash-merged branches locally by checking upstream status. This allows the cleanup workflow to identify branches that are fully merged even when standard commit history is absent.

Why does Git branch -d fail after a squash merge?▼

Git branch -d fails after a squash merge because the local branch history diverges from the main branch without a standard merge commit. Detecting upstream status allows a fallback to forced deletion if appropriate.

Does this branch cleanup workflow prune origin remotes as well?▼

Yes, the branch cleanup workflow prunes origin remotes. It removes stale remote-tracking references after deleting the local branch, ensuring your repository state remains synchronized with the remote server.