Skip to content

feat(plugin): add branch deletion option after worktree remove#57

Merged
guodong-sq merged 3 commits intomainfrom
guodong/plugin-branch-deletion-option
Mar 23, 2026
Merged

feat(plugin): add branch deletion option after worktree remove#57
guodong-sq merged 3 commits intomainfrom
guodong/plugin-branch-deletion-option

Conversation

@guodong-sq
Copy link
Collaborator

@guodong-sq guodong-sq commented Mar 23, 2026

Summary

  • Add BranchDeletionMode setting (Ask / Always / Never) to Settings > Tools > Worktree Manager
  • After worktree removal, offer to delete the branch via IntelliJ's built-in GitBrancher.deleteBranches() — provides proper error dialogs, undo support, and automatic git state refresh
  • Protected branches (main, master) are never offered for deletion

Companion to #56 (CLI side, already merged).

Test plan

  • Remove a worktree from plugin — branch deletion dialog appears (when set to Ask)
  • Set to "Always" — branch deleted without dialog
  • Set to "Never" — branch kept without dialog
  • Unmerged branch — IntelliJ's built-in force-delete dialog appears
  • ./gradlew build passes

🤖 Generated with Claude Code

Delegate to IntelliJ's built-in GitBrancher.deleteBranches() for branch
deletion — provides proper error dialogs, undo support, and automatic
git state refresh.

Add BranchDeletionMode setting (Ask/Always/Never) in Settings > Tools >
Worktree Manager. Default is Ask, which shows a confirmation dialog
after worktree removal. Protected branches (main, master) are never
offered for deletion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
guodong-sq and others added 2 commits March 23, 2026 00:07
The normalizeSafe() path comparison resolved symlink paths to physical
paths, causing the active worktree (accessed via symlink) to incorrectly
match mainRepoRoot. Use the isMain flag from GitParser instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ContextService.reload() is now called in requireConfig() — the single
entry point for all config-dependent actions. This ensures config is
fresh before create/remove/switch operations, not just after.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@guodong-sq guodong-sq merged commit 6c103c2 into main Mar 23, 2026
5 checks passed
@guodong-sq guodong-sq deleted the guodong/plugin-branch-deletion-option branch March 24, 2026 04:21
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