fix(worktree): allow exit_worktree remove when branch is already merged#248
Merged
Conversation
…ed into base - Record the base branch ref in ActiveWorktree. - Use git merge-base --is-ancestor to detect already-merged worktree branches. - Leave base_ref empty for detached HEAD bases to avoid incorrectly treating the worktree branch as merged. - Add regression tests for merged commits and detached HEAD safety. Also bumps version to 0.45.5 and updates CHANGELOG.
Fullstop000
force-pushed
the
fix-exit-worktree-merged
branch
from
July 10, 2026 06:15
d23aea2 to
e0c87c5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After a worktree branch is merged into the base branch (e.g. via a PR),
exit_worktree removestill complains that there are commits not on the base branch and requiresdiscard_changes=true.Fix
ActiveWorktree.git merge-base --is-ancestorto detect whether the worktree branch has already been merged into the current base branch.mainand verifiesremovesucceeds withoutdiscard_changes.Version
Bumps to v0.45.5 and updates CHANGELOG.