fix(commit-commands): detect [gone] branches with git branch -vv in clean_gone#70173
Open
AndrewDongminYoo wants to merge 1 commit into
Open
fix(commit-commands): detect [gone] branches with git branch -vv in clean_gone#70173AndrewDongminYoo wants to merge 1 commit into
git branch -vv in clean_gone#70173AndrewDongminYoo wants to merge 1 commit into
Conversation
… clean_gone `git branch -v` does not emit the `[gone]` upstream-tracking marker, so the detection pipeline matched nothing and the command silently deleted no branches. Switch to `git branch -vv` and match the real marker format `[origin/<branch>: gone]` via `grep ': gone]'` instead of the literal `[gone]`, which never appears.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/clean_gonenever deletes anything because its[gone]detection is broken.Root cause
The command lists branches with
git branch -vand filters withgrep '\[gone\]':Two problems:
git branch -vdoes not print the[gone]marker. The upstream-trackingstate (including
gone) is only emitted bygit branch -vv(doublev).With single
-vthe pipeline matches nothing.[gone]. Git formats it as[origin/<branch>: gone], sogrep '\[gone\]'would not match even with-vv.Net effect: the loop body never runs and no stale branches are removed.
Fix
git branch -vv(both in step 1 and the deletion pipeline).grep ': gone]'.sed 's/^[+* ]*//'(strip all leading*/+/space markers)and clarifying comments.
Verification
Against
git branch -vvstyle input:git branch -v | grep '\[gone\]'): 0 matches.feat-aandwt-bronly (correctly excludesmainand thebehindbranch, and keeps the+worktree branch).