Install
$ agentstack add skill-viknesh20-20-claude-code-tool-kit-git-cleanup ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
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
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
| Action | Count | Status | |--------|-------|--------| | Merged branches deleted | X | Done/Pending | | Stale remote refs pruned | X | Done/Pending | | Old stashes reviewed | X | Done/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-runfirst, then execute
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: viknesh20-20
- Source: viknesh20-20/claude-code-tool-kit
- License: MIT
- Homepage: https://viknesh20-20.github.io/claude-code-tool-kit/
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.