Thread (211 messages) 211 messages, 6 authors, 4d ago

Re: [PATCH v18 5/7] branch: add --delete-merged <branch>

From: Phillip Wood <hidden>
Date: 2026-07-14 13:01:39

On 13/07/2026 19:17, Harald Nordgren wrote:
quoted
quoted
quoted
This exposes something that I don't love about this feature,
by "this feature" do you mean "git branch --delete-merged"?
quoted
which is
that when using a pushDefault (like we do in the tests with 'git
config remote.pushDefault fork') if not adding a special case for the
main/master branch (like 'git config branch.main.pushRemote origin'),
then it will get cleaned up as a forked branch.
Oh, so because the default push remote is not "origin" we need to
override that for the branches that we do push to "origin". That's a
pain, but even if we did add a special case for the default branch, it
would not protect other branches like "next" and "seen".
Thinking about this a bit more, rather than protecting branches where
$branch@{push} == $branch@{upstream}, perhaps we should be protecting
branches that are merged into their upstream but

      git push branch.$branch.remote $branch

would update $branch@{upstream}. So we'd apply the push refspec to the
branch name, then apply the fetch refspec to that and check the result
did not match the name of the upstream branch.

Does that make sense?
This makes a lot of sense and fixes my major gripe. Seems very
possible to implement as well, I'll give it a shot.
That's great
Are you done with the rest of your review so I can push out the next version?
Yes, though I've just remembered that when we were discussing protecting 
branches that are the upstreams of another branch Junio was keen for us 
to extend that protection to "git branch -d" as well.

Thanks

Phillip
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help