Skip to content

feat: delete branch after PR merge with confirmation prompt - #29

Merged
jongio merged 2 commits into
mainfrom
feature/delete-branch-after-merge
Mar 21, 2026
Merged

jongio merged 2 commits into
mainfrom
feature/delete-branch-after-merge

Conversation

@jongio

@jongio jongio commented Mar 21, 2026

Copy link
Copy Markdown
Owner

Closes #26

Summary

Converts the PR merge flow from a pre-merge Delete branch after merge checkbox to a post-merge confirmation prompt. After a PR is successfully merged, a confirmation dialog asks whether to delete the source branch (remote + local). This is safer because the user decides only after confirming the merge succeeded.

Changes

internal/panels/gitinfo/gitinfo.go

  • Remove deleteBranch field from prMergeResultMsg
  • Add prBranchDeleteResultMsg for async branch deletion results
  • Add opPRDeleteBranchAfterMerge pending operation
  • Change doMergePR() from ShowActionPickerWithCheckbox to ShowActionPickerWithMessage (no more checkbox)
  • Simplify opPRMergeStrategy / opPRMergeConfirm handlers (remove deleteBranch plumbing)
  • Simplify mergePRCmd() — merge only, no branch deletion
  • Update handlePRMergeResult() — after success, show Delete branch? confirmation
  • Add handlePRBranchDeleteResult() — handles all 4 error combinations with appropriate toasts
  • Add opPRDeleteBranchAfterMerge case in handleModalResult() — deletes remote (GitHub API) + local (git branch -d)

internal/panels/gitinfo/gitinfo_extra_test.go

  • Update existing merge strategy/confirm tests for simplified pendingName format
  • Add tests: post-merge prompt shown/not shown, confirm/cancel deletion, empty branch edge case
  • Add tests: all 4 branch delete result combinations (success, remote error, local error, both)

Testing

  • go build ./... — clean
  • go test ./... -count=1 — all 48 packages pass
  • go vet ./... — clean

Test and others added 2 commits March 21, 2026 14:58
Replace the pre-merge "Delete branch after merge" checkbox with a
post-merge confirmation dialog. After a PR is successfully merged,
the user is prompted to delete the source branch (remote + local).

- Remove deleteBranch checkbox from merge strategy picker
- Add opPRDeleteBranchAfterMerge pending operation
- Show confirmation prompt after successful merge
- Delete remote branch via GitHub API and local via git
- Handle all error combinations with appropriate feedback
- Add/update tests for the new post-merge deletion flow

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jongio
jongio merged commit 23e08ea into main Mar 21, 2026
2 checks passed
@jongio
jongio deleted the feature/delete-branch-after-merge branch March 21, 2026 22:18
jongio added a commit that referenced this pull request May 16, 2026
Squash merge of swarm/2026-05-15 branch resolving 55 GitHub issues.

Closes #4, #5, #6, #7, #8, #9, #10, #11, #12, #13, #14, #15, #16, #17, #18, #19, #20, #21, #22, #23, #24, #25, #26, #27, #28, #29, #30, #31, #32, #33, #34, #35, #36, #37, #38, #39, #40, #41, #42, #43, #44, #45, #46, #47, #48, #49, #50, #51, #52, #53, #54, #55, #56, #57, #58

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

feat: delete branch after PR merge with confirmation prompt

1 participant