Re: [PATCH v14 4/6] branch: add --prune-merged <branch>
- From
Harald Nordgren <haraldnordgren@gmail.com>
- Date
- Jun 20, 2026, 09:04 UTC
- Message-ID
- <CAHwyqnWt59h2HO5EJbFswYr7QEA7oNZKdBt_vTk5axNbWFZbpA@mail.gmail.com>
- In-Reply-To
- <xmqq33yimsdp.fsf@gitster.g>
> - Move the @{upstream} of feature2 to the branch that "merged"
> feature1 and caused its removal. Asking feature2@{upstream}
> would answer origin/master, which feature1 was removed after
> getting merged.I think this is a strong option.
As a side note: I was annoyed before when GitHub didn't re-assign base automatically when doing stacked PR's, so merging in the first branch caused developers to merge in the second PR into essentially a dead feature branch instead of master, if they forgot to manually change it. But I think GitHub has fixed this now so the second PR gets its base changed to default branch.
Two caveats:
- How to handle recursion: b1 has b2 as upstream and b2 has b3 as upstream, and both b2 and b3 have been merged? Not good if it's just luck which order the branches get walked, but also we don't want to have to do many passes, two passes is not even guaranteed to be enough. - What about when b3 has itself as upstream? I guess then we can just remove the upstream of b2. Overall, I don't think it's a huge problem when a branch gets no upstream, so maybe just warn about it.
Harald