{"slug":"cleanup-git-4","title":"cleanup-git","summary":"Imported from alexei-led/cc-thingz/dist/codex/git-flow/skills/cleanup-git.","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-10-01T19:35:14.816612Z","repo":{"url":"https://github.com/alexei-led/cc-thingz","stars":36,"forks":5,"license":"MIT","updatedAt":"2026-09-30T10:11:40Z"},"bodyHtml":"<hr>\n<h2>{\"description\":\"Remove merged local branches and stale git worktrees. Use when the user says \"cleanup branches\", \"prune worktrees\", \"tidy git\", \"remove merged branches\", \"delete merged branches\", \"gone branches\", or wants to clean local git state. NOT for creating commits, creating worktrees, or configuring git hooks.\",\"name\":\"cleanup-git\"}</h2>\n\n\n<h1>Cleanup Git</h1>\n<p>All deletion goes through the cleanup script: the target repo's own <code>scripts/cleanup-git.sh</code> if it ships one, otherwise this skill's <code>scripts/cleanup-git.sh</code>. Do not hand-write branch or worktree deletion commands.</p>\n<pre><code>scripts/cleanup-git.sh                  # preview (default)\nscripts/cleanup-git.sh --apply          # delete after user approval\nscripts/cleanup-git.sh --apply --force  # also delete branches with ahead commits\nscripts/cleanup-git.sh --base &lt;ref&gt;     # override base detection\n</code></pre>\n<p>The script fetches and prunes remotes, then picks the base from the remote default branch, then local or remote <code>main</code>, <code>master</code>, <code>trunk</code>, <code>develop</code>, or <code>dev</code>.</p>\n<h2>What the script decides</h2>\n<p>A branch or its worktree is a candidate when one of these holds:</p>\n<ul>\n<li><code>PR merged</code>: <code>gh pr view &lt;branch&gt;</code> reports <code>MERGED</code>. This catches squash and rebase merges; ahead commits count only past the PR head commit.</li>\n<li><code>upstream gone</code>: the tracking branch was deleted.</li>\n<li><code>merged</code>: the branch is an ancestor of the base.</li>\n</ul>\n<p>It always skips the current worktree, the current branch, the base, and <code>main</code>/<code>master</code>/<code>trunk</code>/<code>develop</code>/<code>dev</code>. It keeps dirty worktrees. It keeps candidates with ahead commits, or an unknown ahead count, unless <code>--force</code> is passed. A branch with none of these signals prints <code>skip ... (active)</code>; without <code>gh</code>, squash-merged branches land there.</p>\n<h2>Workflow</h2>\n<ol>\n<li>Run the preview and show it. Read each line literally: <code>remove &lt;worktree&gt;</code> and <code>delete &lt;branch&gt;</code> are candidates; <code>KEEP ... (dirty)</code>, <code>KEEP ... (N ahead — use --force)</code>, and <code>KEEP ... (ahead unknown — run git fetch ...)</code> need the user; <code>skip</code> lines for the current, base, or protected branch are guarded; mention <code>skip ... (active)</code> lines when <code>gh</code> is unavailable.</li>\n<li>Present every <code>KEEP</code> line as a decision for the user.</li>\n<li>Ask before <code>--apply</code>. Add <code>--force</code> only when the user confirms the ahead commits are throwaway.</li>\n</ol>\n<p>Stop if the directory is not a git repo. If no base is found, ask for <code>--base &lt;ref&gt;</code>. A fetch failure makes the preview use stale refs (say so) and makes <code>--apply</code> refuse.</p>\n<h2>Output</h2>\n<pre><code>GIT CLEANUP\nStatus: PREVIEW | APPLIED | BLOCKED\nBase: &lt;ref&gt;\nRemove: &lt;branch/worktree&gt; — &lt;reason&gt;\nKeep: &lt;branch/worktree&gt; — &lt;reason and decision needed&gt;\nVerification: &lt;command&gt; — pass/fail/not run\n</code></pre>\n","files":[{"path":"scripts/cleanup-git.sh","sizeBytes":8682,"isText":true},{"path":"SKILL.md","sizeBytes":2900,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-10-01T19:37:29.780467Z","sha256":"8F1C8A082D086359C584C6D54CB26F9CD6CB5417066BB037DDEE259A8E471C13","sizeBytes":4223},"review":null,"source":{"repositoryUrl":"https://github.com/alexei-led/cc-thingz","path":"dist/codex/git-flow/skills/cleanup-git","license":"MIT","commit":"ce56bb43c7f803a192be038135c5e2bb4cd2249f","subtreeSha":"9353AFA564DAF465DBFD3435D1763C6C7BFE67D7669CE40BD79E82EB1E366377","lastSyncedAt":"2026-10-01T19:34:58.8618Z"},"reviewedAt":"2026-10-01T19:41:18.046199Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/alexei-led/cc-thingz/tree/master/dist/codex/git-flow/skills/cleanup-git"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install alexei-led-cc-thingz@llmmart"},{"target":"git","command":"git clone https://github.com/alexei-led/cc-thingz.git"}]}