Re: [PATCH v18 5/7] branch: add --delete-merged <branch>
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Jul 13, 2026, 15:39 UTC
- Message-ID
- <5212d968-6121-466c-8225-36b4bad6b211@gmail.com>
- In-Reply-To
- <CAHwyqnWspUTSnqmkMyXtWuAnENDSzrRLhhUR=Ljtt1xer3tphA@mail.gmail.com>
On 11/07/2026 20:36, Harald Nordgren wrote:
Show 19 quoted lines
>>>> + ( >>>> + cd repo && >>>> + git checkout -b mainline main && >>>> + git checkout -b on-local mainline && >>>> + git branch --set-upstream-to=mainline on-local && >>> >>> Why do we need on-local to track mainline rather than main? I'm a bit >>> confused what the point of mainline is. >> >> It's to have an indirection of a branch that is the same as main but >> will be protected. I tried to delete it now and replace it with just >> main, but then main was deleted and subsequent tests failed. > > Digging more into this, probably the most elegant solution is to > replace mainline with main, but then also do this: > > git config branch.main.pushRemote origin > > This exposes something that I don't love about this feature,
by "this feature" do you mean "git branch --delete-merged"?
Show 5 quoted lines
> 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".
We should maybe add a note to the documentation about that to warn users.
> But there was a lot of discussion about this already, so I won't get > into this again.
Fair enough
Thanks
Phillip