git-hygiene-orchestrator

Audit and clean Git branches, remote-tracking refs, and worktrees with evidence-based safety gates.

Updated Dec 20, 2025
One-click install
npx skills add https://github.com/koala-man-64/helpful-scripts --skill git-hygiene-orchestrator-koala-man-64
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: git-hygiene-orchestrator
Source: https://github.com/koala-man-64/helpful-scripts/tree/main/exports/codex-skills/repo-local/git-hygiene-orchestrator
Command: npx skills add https://github.com/koala-man-64/helpful-scripts --skill git-hygiene-orchestrator-koala-man-64

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Repositories accumulate stale branches, orphaned remote-tracking refs, and abandoned worktrees over time, and cleaning them up manually risks deleting unmerged work or dirty changes. This Skill performs an audit-first Git hygiene review that classifies every branch and worktree by risk before recommending or executing any cleanup. ## Core Features & Use Cases - Evidence-Based Branch Classification: Uses merge-base, ahead/behind counts, upstream status, and diff evidence to classify branches as Keep, Delete local, Review, or High risk instead of relying on age alone. - Worktree and Conflict Audits: Inspects every worktree for dirty, conflicted, locked, or prunable state and identifies conflict types (content, rename/delete, add/add) with per-file resolution recommendations. - Risk-Tiered Cleanup Execution: Separates low-risk metadata pruning (git worktree prune, git remote prune) from higher-risk local branch deletion, worktree removal, and remote branch deletion, requiring explicit approval for destructive actions. - Finish Workflow: When authorized, runs the full validate-commit-push-PR-merge sequence with squash merge, auto-complete, and source-branch deletion defaults for Azure Repos and GitHub. - Use Case: After months of feature work, a repository has 40 local branches and 6 worktrees. Use this Skill to inventory everything, identify which merged branches are safe to delete, preserve unmerged work, and produce an exact cleanup command list. ## Quick Start Use the git-hygiene-orchestrator skill to audit this repository's branches, remote refs, and worktrees and recommend safe cleanup commands.

Frequently Asked Questions about git-hygiene-orchestrator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely delete stale Git branches?▼

Run an inventory with git branch --merged and git branch -vv to identify branches merged into the primary branch with no unique commits, then delete them with git branch -d. Never use git branch -D on unmerged branches without reviewing their unique commits first.

How to clean up Git worktrees without losing uncommitted work?▼

Audit each worktree with git status, git diff --stat, and git ls-files --others to classify it as clean, dirty, or conflicted. Only remove worktrees that are fully clean using git worktree remove, and use git worktree prune for metadata of already-deleted paths.

What is the difference between git worktree prune and git remote prune?▼

git worktree prune removes administrative metadata for worktrees whose directories no longer exist, while git remote prune origin deletes local remote-tracking refs for branches deleted on the remote. Both are low-risk metadata operations that should still be verified with --dry-run first.

Can I delete remote Git branches automatically?▼

Remote branch deletion with git push origin --delete is treated as higher risk than local deletion and requires explicit approval. It should only proceed when the branch is merged into the primary branch, has no unique commits, and repository policy permits deletion.

Why should I avoid git branch -D when cleaning up branches?▼

git branch -D force-deletes branches regardless of merge status, which can permanently lose unmerged commits. Prefer git branch -d, which refuses to delete unmerged branches, and only force-delete after reviewing unique commits with git log origin/main..branch.