Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
alibaba avatar

Git Cleanup

  • 14 installs
  • 28.4k repo stars
  • Updated August 4, 2026
  • alibaba/page-agent

git-cleanup is a Claude Code skill that cleans up local git branches and non-origin remotes left over from reviewing pull requests.

About

This skill cleans up local git branches and remotes that accumulate from reviewing multiple pull requests. It surveys branches, remotes, and stashes, then safely deletes non-main branches and non-origin remotes after confirmation. A developer uses it to tidy local git state after a round of PR reviews.

  • Cleans local git branches except main and current
  • Removes non-origin contributor remotes
  • Runs safety checks and asks before deleting

Git Cleanup by the numbers

  • 14 all-time installs (skills.sh)
  • Ranked #404 of 733 Git & Pull Requests skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

git-cleanup capabilities & compatibility

Capabilities
branch cleanup · remote cleanup · git housekeeping
Works with
github
Use cases
code review
From the docs

What git-cleanup says it does

Clean local branches (except `main` and current branch) and non-origin remotes.
SKILL.md
**NEVER** delete `main` or the current checked-out branch
SKILL.md
npx skills add https://github.com/alibaba/page-agent --skill git-cleanup

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs14
repo stars28.4k
Last updatedAugust 4, 2026
Repositoryalibaba/page-agent

What it does

Clean up stale local git branches and contributor remotes left over from PR reviews.

Who is it for?

Tidying local git branches and remotes after reviewing multiple pull requests

Skip if: Deleting main or the current checked-out branch, which it never touches

When should I use this skill?

You ask to clean branches, remove stale remotes, or tidy local git state

What you get

Local branches other than main/current and non-origin remotes are safely removed after confirmation.

  • Pruned local branches
  • Removed non-origin remotes

By the numbers

  • 4 survey commands run in parallel (branch, remote, status, stash)
  • 5-step workflow

Files

SKILL.mdMarkdownGitHub ↗

Git Cleanup

Clean local branches (except main and current branch) and non-origin remotes. Useful after reviewing multiple PRs that leave behind tracking branches and contributor remotes.

Workflow

1. Survey

Run these in parallel:

git branch
git remote
git status --short
git stash list

Present a summary of how many branches and remotes will be removed.

2. Safety Checks — Ask Before Proceeding

Stop and ask for confirmation if any of these are true:

  • Current branch is NOT main
  • Working tree has uncommitted changes or stashes
  • Any branch is ahead of its upstream

List unmerged branches separately and let the user decide.

3. Delete Branches

# Safe delete first (fails on unmerged branches)
git branch | grep -v '^\*' | grep -v '^\s*main$' | xargs git branch -d 2>&1

# Force-delete only with explicit user approval
git branch -D <branch>

4. Remove Remotes

git remote | grep -v '^origin$' | xargs -I{} git remote remove {}

5. Confirm

git branch && echo "---" && git remote

Report what was cleaned up.

Key Rules

  • NEVER delete main or the current checked-out branch
  • NEVER force-delete unmerged branches without user confirmation
  • If in doubt, ask

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.