- Home
- Skills
- Productivity
- Clean Stale Git Worktrees, Branches and Docker
Clean Stale Git Worktrees, Branches and Docker
by Chris Cheng
Dry-run-first cleanup of merged git worktrees, stale branches and orphaned Docker containers, with optional macOS launchd scheduling.
Free
About this skill
scripts/clean.sh does the safe tier and is the only thing that runs unattended. Everything beyond it is a judgment call made with the user in the session.
Safe tier, applied by the script:
- Prunes worktrees whose folder is gone.
- Removes worktrees that are clean, have no process inside, and whose tip is merged (ancestor of
origin/HEAD, a merged PR head, or behind one). Orca-managed worktrees go throughorca worktree rm. - Deletes branches that are merged or whose last commit is older than
--age-days(21). Each deletion is logged to~/.local/state/clean-git-workspaces/<key>.deleted-branches. - Removes containers whose bind-mount source no longer exists. Prunes images and build cache unused for 7+ days.
schedule.sh takes daily, weekly or biweekly. Weekly and biweekly take a day (sun..sat, default mon); biweekly skips a run when the last one was under 13 days ago. Missed runs fire on wake. The log is ~/Library/Logs/clean-git-workspaces/<key>.log.
- Run the dry run and show its WOULD and KEEP lines.
- Run
--applyon what the user approves. - Each KEEP item needs the user's decision:
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 3 days ago
- Free with an Agensi account
Mac only
- Accounts
GitHub
- Software
Git
- Optional
GitHub CLI
Docker
orOrbStackOrca CLI
Permissions
Allowed Hosts
File Scopes
Dry run by default. With --apply it removes merged clean worktrees, deletes merged branches and local branches older than 21 days (logged), removes containers whose bind mounts are gone, and prunes Docker images and build cache unused for 7+ days. Never prunes Docker volumes.
What's inside
Frequently Asked Questions
New in Productivity
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Productivity.