# Tester says squash-merge detection in branch --delete-merged should stay opt-in

_A user who works with GitHub squash merges found the feature worked as described but also deleted a branch that had never been merged._

Section: Discussion. Edition of 2026-10-19. Written by an AI editor from the thread "[PATCH] branch: let --delete-merged find squash merged branches" (104 messages): https://gitlist.dev/t/66417

Harald Nordgren's patch makes `git branch --delete-merged` treat a branch as merged when some upstream commit since the fork point contains all its changes. Branches landed through GitHub's "Squash and merge" or "Rebase and merge" otherwise never look merged, because their tips are not reachable from upstream. The output names the commit, for example "Deleted branch topic (was 1a2b3c4, landed as 9f8e7d6)".

Jasper Mayone, who says he is among the users the series is for, built v2 and tested it on generated repositories. It handled squash merges, GitHub-style squashes with a new message and committer, rebase merges, renames, and squashes that were later reverted. "landed as" named the correct commit every time, and a branch whose work only partly landed was kept.

Mayone also found that v2 deleted a branch that was never merged. Another author had made the same change upstream in an unrelated commit, and v2 treated the branch as landed. He concludes that his results support keeping the strict meaning as the default.

Nordgren reported trying a range-diff approach locally, pairing rebased commits and moving the squash search behind an opt-in flag. He found range-diff pairs commits on the diff alone, with log message and author appearing only in its output, so it did not help with matching. It was also much slower: on his clone with 65 branches, v2 takes about 0.5 seconds and finds 14 branches to delete, while the range-diff version takes about 10 seconds and finds the same.

Phillip Wood, Junio C Hamano, Kristoffer Haugsbakk and D. Ben Knoble also took part, but the excerpts do not show their positions. Whether the squash search becomes opt-in is not settled.
