branch: let --delete-merged find squash merged branches - #2425
Draft
HaraldNordgren wants to merge 1 commit into
Draft
HaraldNordgren wants to merge 1 commit into
HaraldNordgren wants to merge 1 commit into
Conversation
HaraldNordgren
force-pushed
the
branch-delete-squashed
branch
from
September 25, 2026 12:08
7ede3dc to
f51ed49
Compare
Branches merged on GitHub with "Squash and merge" or "Rebase and
merge" are never deleted by "git branch --delete-merged". The upstream
holds a rewritten copy of their work, so their tips are not reachable
from it and they look unmerged forever.
Treat such a branch as merged when some upstream commit since the fork
point contains all of its changes, so that merging the branch into
that commit would change nothing. Name that commit in the output so
the user can see where the work went:
Deleted branch topic (was 1a2b3c4, landed as 9f8e7d6).
The first upstream commit that contains the changes is used, so the
branch is deleted even if upstream later reverted or reworked them.
Nothing is lost, since that commit keeps them in the upstream history.
A branch whose changes only partly landed is kept.
Signed-off-by: Harald Nordgren <[email protected]>
HaraldNordgren
force-pushed
the
branch-delete-squashed
branch
from
September 25, 2026 13:35
f51ed49 to
2ea14b2
Compare
This branch has not been deployed
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.
Branches merged on GitHub with "Squash and merge" or "Rebase and merge" are never deleted by
git branch --delete-merged, because their tips are not reachable from the upstream. This treats such a branch as merged when some upstream commit contains all of its changes, and names that commit in the output: