# `git branch` series to delete squash-merged and rebase-merged branches reaches v4

_The series would delete branches whose work landed upstream in rewritten form, which `--delete-merged` currently never does._

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

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 upstream. Harald Nordgren's series addresses this. The output would read, for example, "Deleted branch topic (was 1a2b3c4, landed as 9f8e7d6)."

The v4 cover letter says the series finds the first upstream commit since the fork point that has the branch's version of every file the branch changed, comparing only object ids. With `--squashed`, a file that upstream also changed counts if merging the branch's version into upstream's leaves it unchanged.

The patches add a way for delete_branches() to take a map from branch names to the upstream commit where each branch landed. They also move the `branch.<name>.deleteMerged=false` check into a helper so the new mode honors it. The cover letter lists changes in v4, including a note that `--delete-merged` works as it does today, but the excerpt cuts off there.

Kristoffer Haugsbakk, D. Ben Knoble, Phillip Wood, Junio C Hamano and Jasper Mayone took part in the 60-message thread. Their positions are not visible in the excerpts.

