Clean After Merged — Git skill for Claude Code
Switch to the repo's main branch, pull, and delete the just-merged local branch.
How to install Clean After Merged
Installs to ~/.claude/commands/coralogix-cx-ios-sdk-clean-after-merged.md
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/coralogix/cx-ios-sdk/HEAD/.claude/commands/Clean-After-Merged.md -o ~/.claude/commands/coralogix-cx-ios-sdk-clean-after-merged.md Restart Claude Code, or start a new session, for it to be picked up.
What Clean After Merged does
description: Switch to the repo's main branch, pull, and delete the just-merged local branch.
You're cleaning up after a PR was merged on the remote. The local branch the user is on was the head of that PR and is no longer needed locally.
Do exactly this, in order, in the current working directory:
**Capture the current branch name** with `git rev-parse --abbrev-ref HEAD`. Store it as `MERGED_BRANCH`.
**Refuse to run** if `MERGED_BRANCH` is `master`, `main`, or `develop`. Print
Alternatives in Git
- Ws Reset — Reset the current branch to main, fetch upstream, and update submodules 38.1k ★
- Clean Worktrees (Automatic) — Automatically remove all worktrees for branches merged into master 25.5k ★
- OSS PR — Commit + PR workflow for open source contributions: auto-creates a user-prefixed branch when on main/master, t 19.7k ★
Full documentation available on GitHub
View Source RepositoryRelated Skills
Branch Cleanup
Clean up merged, stale, and orphaned git branches. Protects main/develop/release/ automatically. Supports --dr
Git.Merge
Merge the current branch's PR, switch to the default branch, and clean up all merged/gone local and remote bra
PR Merged
Post-merge cleanup — checkout main, pull latest, delete the feature branch, and close the linked work item.
CloseBranch
Close out a branch after its PR is merged/closed - switches to the PR's base branch (main, or the todo's arc b
Reset Branch
Switch to main and delete previous branch
Cleanup Worktree
Remove a merged worktree and its branch after verifying it was merged into main
Related Agents
Branch Janitor
Post-merge cleanup agent — after the human confirms a PR/branch merge, removes stale agent worktrees, deletes
Merger
Reviews, validates, and merges arc-agents PRs. Sole authority for destructive git ops (rebase, push, merge, br
Branch Hygiene
MUST be used whenever the user asks to find stale, merged, or orphaned git branches, or asks to review/clean u