Conversation
…letion When checkout-branch creates a branch from origin/main (because local main is behind), the new branch ends up ahead of local main. Deleting it later would fail with "not merged into main" even though the branch is an ancestor of origin/main and the user made no changes. Fix by also checking against the remote tracking ref (origin/main) in is_branch_merged, and always using git branch -D for the actual deletion since our validation is more comprehensive than git's built-in branch -d check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4e8452e to
294a381
Compare
Merged
5 tasks
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.
Summary
branch-deletenow checks merge status against both the local default branch AND its remote tracking branch (e.g.,origin/main), fixing false "not merged" errors when the local default branch is behind the remotecheckout-branchcreates branches fromorigin/main, the new branch can be ahead of local main even with no user changes -- the old validation only checked local main and incorrectly rejected deletiongit branch -D(force) for actual deletion since our validation is more comprehensive than git's built-inbranch -dcheckFixes #232
Test plan
branch_delete_local_behind_remotethat reproduces the exact scenario🤖 Generated with Claude Code