From: Harald Nordgren Date: Mon, 13 Jul 2026 18:17:00 GMT Subject: Re: [PATCH v18 5/7] branch: add --delete-merged Message-ID: In-Reply-To: <279e6d69-191b-437a-b1b1-ecd879343f3d@gmail.com> > >> This exposes something that I don't love about this feature, > > > > by "this feature" do you mean "git branch --delete-merged"? > > > >> 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. Are you done with the rest of your review so I can push out the next version? Harald