agentsclimarketplace

Git cleanup

Skill viknesh20-20/claude-code-tool-kit/.claude/skills/git-cleanup

Production-ready Claude Code configuration. 12 original agents, 200+ slash-command skills, 45+ MCP servers, 14 plugins, design + 3D + WebGPU + GSAP + RAG tooling. One-command Node.js installer for premium websites, SaaS apps, AI agents. Free, MIT, stack-agnostic.

Install
npx -y skills add viknesh20-20/claude-code-tool-kit --skill git-cleanup

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 5 stars5 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Cleans up stale git branches, merged branches, orphaned remote refs, and identifies large files in history. Use for periodic repository maintenance.

SKILL.md

2.2 KB, as published. Nobody here has run it

Git Repository Cleanup

Current State

!git branch -a 2>/dev/null | head -30 !git remote -v 2>/dev/null !git stash list 2>/dev/null


Cleanup Steps

Step 1: Identify Merged Branches

List local branches already merged into main/master:

git branch --merged main 2>/dev/null || git branch --merged master 2>/dev/null

Present the list to the user and ask for confirmation before deleting.

Safe to delete (already merged):

git branch -d <branch-name>

Step 2: Identify Stale Remote Branches

Prune remote tracking refs that no longer exist:

git remote prune origin --dry-run

After confirmation:

git remote prune origin

Step 3: Identify Old Unmerged Branches

List branches with no commits in the last 90 days:

git for-each-ref --sort=committerdate --format='%(committerdate:short) %(refname:short)' refs/heads/ | head -20

Never delete unmerged branches without explicit user approval.

Step 4: Clean Up Stashes

List all stashes:

git stash list

For old stashes (>30 days), suggest review and cleanup.

Step 5: Repository Size Analysis

Check for large files:

git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sort -k3 -n -r | head -20

Step 6: Garbage Collection

git gc --auto

Output

Cleanup Summary

ActionCountStatus
Merged branches deletedXDone/Pending
Stale remote refs prunedXDone/Pending
Old stashes reviewedXDone/Pending

Branches NOT Deleted (unmerged)

List branches that were skipped with last commit date.

Space Recovered

Before and after repository size (if gc was run).


Rules

  • NEVER force-delete (git branch -D) without explicit user confirmation
  • NEVER delete main, master, develop, or release branches
  • Always show what will be deleted before doing it
  • Prefer --dry-run first, then execute

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.