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 ★
- Merge Command — Finalize worktree work: update docs, commit, merge to main, clean up 1.3k ★
Full documentation available on GitHub
View Source RepositoryRelated Skills
Dip
Post-merge cleanup — switch to base branch, pull latest, delete the merged feature branch, restore any stash.
PR Post Merge
Clean up after a PR is merged — close fork issue, update local branch, delete issue branch
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.
Git Contribute Finish
Clean up after your claude-harness pull request merged, by updating master and deleting the feature branch loc
Related Agents
Branch Janitor
Post-merge cleanup agent — after the human confirms a PR/branch merge, removes stale agent worktrees, deletes
Branch Gardener
Triages local branches and stashes in a managed repo (merged, stale, superseded, unpushed) and proposes deleti
Merger
Reviews, validates, and merges arc-agents PRs. Sole authority for destructive git ops (rebase, push, merge, br