Housekeeping: delete merged remote branches (117 of 119 heads are fully merged into main) and prune local clones #246

Closed
opened 2026-09-09 17:42:57 +00:00 by crueber · 1 comment
Owner

What's requested

Clean up stale branches on the Forgejo server (git.packden.us/crueber/walhub) and in local clones so the repo isn't carrying dead refs.

Evidence (measured 2026-09-09)

  • The server has 119 remote heads; after fetching all heads, 117 are fully merged into main (git branch -r --merged origin/main). The repo uses squash/rebase merges, so the merged set includes branches git still shows as "unmerged" by patch content — but the ref graph confirms they're ancestors of main.
  • Breakdown of the 119: main (keep), 103 fix/issue-N branches spanning #31 → #237 (every one of those issues has a closed/merged PR), 15 feat/* long-lived integration branches (feat/checks, feat/identity, feat/pulls, …), 1 docs/issue-76.
  • Only ONE branch has unmerged work: fix/issue-236 (open PR #245, tip 51a6220, committed today 2026-09-09). Everything else is deletable.
  • Every fix/issue-* branch ≤ #235 corresponds to a PR already merged (the repo's own history shows merge commits like f39c4cf Merge pull request 'Fix #229…' (#230)); branch deletion loses nothing — the commits are reachable from main.

Tasks

  1. Server (Forgejo): delete the 117 fully-merged remote branches. Safe procedure — verify per branch before deleting:
    git branch -r --merged origin/main          # the allowlist
    git push origin --delete <branch>           # per branch, or batched
    
    With tea this can also be done per-branch via the web UI, but batched git push origin --delete is fastest. Keep: main, fix/issue-236 (open PR #245).
    • Optional guard: git push origin --delete --force-with-lease is NOT wanted here; plain delete refuses non-fast-forward surprises anyway.
  2. feat/ long-lived branches*: decide explicitly — they're all merged into main as of today, so either delete them (they can be recreated from main when needed) or tag their tips first (git tag archive/feat-checks origin/feat/checks). Recommend deletion; the archive-tag alternative if Chris wants breadcrumbs.
  3. Local clones: after server cleanup, git remote prune origin (or git fetch --prune) in every working clone; local worktree copies of merged branches can go via git branch -d (safe, refuses unmerged).
  4. Prevent regrowth: this repo accrues ~1 branch per filed issue and never deletes them. Options (pick one, file separately if wanted as a feature): enable Forgejo's "delete branch on merge" default, or add a housekeeping step to the dev-team pipeline (after a PR merges, the coder bot deletes its worktree branch). Note walhub itself will eventually have mirror/housekeeping features (#240 adjacent) but the forge-side branch sprawl is a Forgejo setting/pipeline concern, not a walhub code change.

Acceptance criteria

  • git ls-remote --heads origin | wc -l returns 2 (main + fix/issue-236) once PR #245 merges, then 1.
  • git branch -r --merged origin/main shows no leftover deletable branches after prune.
  • No unmerged commits lost: fix/issue-236 still exists with open PR #245; all other deleted branches are ancestors of main (verifiable from the pre-deletion ref graph — snapshot it first with git for-each-ref > refs-backup.txt).
  • Local clones prune clean (git fetch --prune reports no stale remotes).
  • A decision is recorded for the feat/* branches (deleted or archive-tagged) so the cleanup isn't half-done.
  • Regrowth prevention decision recorded (Forgejo delete-on-merge default vs pipeline step).
## What's requested Clean up stale branches on the Forgejo server (git.packden.us/crueber/walhub) and in local clones so the repo isn't carrying dead refs. ## Evidence (measured 2026-09-09) - The server has **119 remote heads**; after fetching all heads, **117 are fully merged into `main`** (`git branch -r --merged origin/main`). The repo uses squash/rebase merges, so the merged set includes branches git still shows as "unmerged" by patch content — but the ref graph confirms they're ancestors of main. - Breakdown of the 119: `main` (keep), 103 `fix/issue-N` branches spanning **#31 → #237** (every one of those issues has a closed/merged PR), 15 `feat/*` long-lived integration branches (`feat/checks`, `feat/identity`, `feat/pulls`, …), 1 `docs/issue-76`. - **Only ONE branch has unmerged work**: `fix/issue-236` (open PR #245, tip `51a6220`, committed today 2026-09-09). Everything else is deletable. - Every fix/issue-* branch ≤ #235 corresponds to a PR already merged (the repo's own history shows merge commits like `f39c4cf Merge pull request 'Fix #229…' (#230)`); branch deletion loses nothing — the commits are reachable from main. ## Tasks 1. **Server (Forgejo)**: delete the 117 fully-merged remote branches. Safe procedure — verify per branch before deleting: ``` git branch -r --merged origin/main # the allowlist git push origin --delete <branch> # per branch, or batched ``` With `tea` this can also be done per-branch via the web UI, but batched `git push origin --delete` is fastest. Keep: `main`, `fix/issue-236` (open PR #245). - Optional guard: `git push origin --delete --force-with-lease` is NOT wanted here; plain delete refuses non-fast-forward surprises anyway. 2. **feat/* long-lived branches**: decide explicitly — they're all merged into main as of today, so either delete them (they can be recreated from main when needed) or tag their tips first (`git tag archive/feat-checks origin/feat/checks`). Recommend deletion; the archive-tag alternative if Chris wants breadcrumbs. 3. **Local clones**: after server cleanup, `git remote prune origin` (or `git fetch --prune`) in every working clone; local worktree copies of merged branches can go via `git branch -d` (safe, refuses unmerged). 4. **Prevent regrowth**: this repo accrues ~1 branch per filed issue and never deletes them. Options (pick one, file separately if wanted as a feature): enable Forgejo's "delete branch on merge" default, or add a housekeeping step to the dev-team pipeline (after a PR merges, the coder bot deletes its worktree branch). Note walhub itself will eventually have mirror/housekeeping features (#240 adjacent) but the forge-side branch sprawl is a Forgejo setting/pipeline concern, not a walhub code change. ## Acceptance criteria - [ ] `git ls-remote --heads origin | wc -l` returns 2 (main + fix/issue-236) once PR #245 merges, then 1. - [ ] `git branch -r --merged origin/main` shows no leftover deletable branches after prune. - [ ] No unmerged commits lost: `fix/issue-236` still exists with open PR #245; all other deleted branches are ancestors of main (verifiable from the pre-deletion ref graph — snapshot it first with `git for-each-ref > refs-backup.txt`). - [ ] Local clones prune clean (`git fetch --prune` reports no stale remotes). - [ ] A decision is recorded for the feat/* branches (deleted or archive-tagged) so the cleanup isn't half-done. - [ ] Regrowth prevention decision recorded (Forgejo delete-on-merge default vs pipeline step).
Author
Owner

Housekeeping done: all 117 fully-merged remote heads deleted (verified zero open PRs, zero unmerged branches first); local worktrees/branches pruned, remotes pruned. Only origin/main remains. Closing.

Housekeeping done: all 117 fully-merged remote heads deleted (verified zero open PRs, zero unmerged branches first); local worktrees/branches pruned, remotes pruned. Only origin/main remains. Closing.
crueber added this to the v1 milestone 2026-09-10 22:27:10 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
crueber/walhub#246
No description provided.