chore: prune 24 stale remote feature branches #167
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
origincarries 26 branches. Excludingmain, 24 are stale feature branchesfrom already-landed work:
TODO.md:51-52already carries this as a Future Step.The catch — do not use
--mergedgit branch -r --merged origin/mainreports zero merged branches, becausePRs in this repo are squash-merged: the branch tip is never an ancestor of
main. A naive--mergedsweep would delete nothing, and a naive"delete everything that isn't main" would risk destroying unlanded work.
Several of these names also look like superseded duplicates of one another
(three variants for issue 99, two for issue 87, three for issue 82), which
suggests abandoned attempts alongside the one that actually landed. Those still
need checking rather than assuming.
Implementation requirements
main.Squash-merges mean you must compare content, not ancestry. Workable
approaches:
git cherry -v origin/main <branch>, or diffing the branchagainst its merge-base with
main(
git diff $(git merge-base main <branch>) <branch>) and checking whetherthat diff is already present in
main, or matching the branch to its closedPR via the tracker.
closed and merged. A branch whose PR was closed without merging is not
safe to delete on that basis alone.
(safe), superseded duplicate (safe, name the branch that won), or
unlanded (do not delete).
so it can be triaged separately. Do not guess.
origin, and only after the classification is posted here.Local branches in the shared clone are already down to
mainalone.main, and do not force-push anything.Definition of done
or unlanded, with the evidence used for each.
origin.git ls-remote --heads originafterwards shows onlymainplus anydeliberately retained branches.
TODO.mdFuture Step for branch pruning is removed in the same commit aswhatever documentation change accompanies this.