Skip to content

feat(branches): clean up all merged local branches - #78

Merged
rocketraman merged 1 commit into
masterfrom
claude/local-branch-cleanup-message-5acf77
Nov 2, 2026
Merged

rocketraman merged 1 commit into
masterfrom
claude/local-branch-cleanup-message-5acf77

Conversation

@rocketraman

Copy link
Copy Markdown
Owner

What

The local Branches heading gets "· Clean up N merged", the local counterpart to the remote sweep added in #77.

  • Which branches: merged ones on screen that a row's own Delete would remove. It skips the current branch, mainline, branches checked out in another worktree, integration branches, "no commits" branches, and hidden branches unless Show hidden is on. Remote copies are left alone.
  • Confirmation: a single merged delete has no prompt, but the sweep asks first and lists the names (Popup.Confirm.details), as the remote one does. A squash-merged branch's original commits go with it; its changes are in mainline.
  • Backend: BranchOps.deleteMany runs git branch -D in chunks (sharing the Windows command-line chunk size), then reads back which refs remain instead of parsing git's translated output. A refused branch (say, checked out in a worktree after the list loaded) is named in the toast with git's reason.
  • State: AppState.cleaningBranches / deleteMergedBranches; the link reads "Cleaning up…" while it runs.

Testing

  • Two new BranchOpsTest cases: full delete, and partial delete where git refuses a branch held by a worktree.
  • ./gradlew test: 254 tests, 0 failures (from the result XML).
  • Not checked by hand in the running app.

The Branches heading gets "Clean up N merged", the local counterpart to
the one each remote got. It deletes every merged branch on screen that a
row's own Delete would, skipping the current branch, mainline, branches
held by another worktree, integration branches and ones with no commits.
Remote copies stay. Like the remote sweep it asks first, listing the
branches, since it deletes ones the click never named.

BranchOps.deleteMany runs chunked `git branch -D` and reads back which
branches are left rather than parsing git's (translated) messages, so a
branch git refuses is named in the toast with its reason.

Signed-off-by: Raman Gupta <rocketraman@gmail.com>
@rocketraman
rocketraman merged commit 3b2b8b5 into master Nov 2, 2026
2 checks passed
@rocketraman
rocketraman deleted the claude/local-branch-cleanup-message-5acf77 branch November 2, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant