본문으로 건너뛰기
cccskills
무료GitHub에 공개

clean-gone-branches

Delete local git branches whose remotes are gone, after verifying via gh CLI that each was actually merged.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구GitHub
설치 방법 보기

포함된 파일(1)

  • SKILL.md2.5 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

What I do

Clean up orphaned local branches (those whose remote tracking branch is [gone]) by:

  1. Running git fetch --prune to sync remote state.
  2. Listing all local branches with [gone] remote tracking refs.
  3. Verifying each branch's PR status via gh pr list --state all to confirm it was merged (or closed).
  4. Showing the user a summary table with PR state and merge date.
  5. Asking for confirmation before deleting.
  6. Force-deleting confirmed branches with git branch -D.

When to use me

  • After a sprint or a batch of PRs land and you want to clean up stale local branches.
  • Any time git branch -vv shows several [gone] entries.
  • Before switching repos or doing a clean checkout.

Workflow

Step 1: Fetch and prune

git fetch --prune

Step 2: Find orphaned branches

git branch -vv | grep ': gone]'

If nothing found, report "No orphaned branches found." and stop.

Step 3: Verify PR status via gh CLI

For each orphaned branch, run:

gh pr list --head "<branch>" --state all --json state,mergedAt,title \
  --jq '.[0] | "\(.state) | merged: \(.mergedAt // "N/A") | \(.title)"'

Build a summary table:

BranchPR StateMerged AtPR Title

Flag any branches that are not MERGED (e.g. OPEN or CLOSED without merge) — these need user attention before deletion.

Step 4: Confirm with user

Show the table and ask:

  • "Delete all MERGED branches now?"

If any branch has no PR or is not merged, exclude it from the default delete list and call it out explicitly:

  • "These branches have no merged PR — skip them or confirm to force-delete anyway?"

Step 5: Delete

git branch -D <branch1> <branch2> ...

Report each deleted branch with its last commit hash.


Behavior rules

  • Never delete without explicit user confirmation.
  • Always use git branch -D (force) since git's merge check is against the local default branch, not the remote — remote deletion already confirms the work is done.
  • If gh is not available or returns no results, warn the user and do not auto-delete.
  • Prefer deleting all confirmed-merged branches in one command rather than one-by-one.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Implement comprehensive error handling for Python code paths to keep services resilient and user-friendly. Use when failures are currently silent or exceptions leak through.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Unique-AG/ai52026년 10월 19일 업데이트

Tabular and numerical data analysis with descriptive statistics and insights. Use when the user provides data, tables, CSVs, or numbers and wants analysis.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Unique-AG/ai52026년 10월 19일 업데이트

Financial factsheet analysis with key metrics extraction and investment rationale

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Unique-AG/ai52026년 10월 19일 업데이트

ci-fix

무료

Diagnose and fix CI failures without leaving your editor.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Unique-AG/ai52026년 10월 19일 업데이트

Reproduce ai-repo PR checks locally with Poe and CI scripts, including per-package typecheck and coverage behavior. Use when validating changes before push or when user asks which local commands match CI.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Unique-AG/ai52026년 10월 19일 업데이트

Ask clarifying questions before implementing to ensure Python requirements are understood. Use when a task lacks detail, dependencies are unclear, or multiple interpretations are possible.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Unique-AG/ai52026년 10월 19일 업데이트

Unique-AG의 스킬 모두 보기

이 스킬의 문제 신고