Re: [PATCH v18 5/7] branch: add --delete-merged <branch>
- From
Harald Nordgren <haraldnordgren@gmail.com>
- Date
- Jul 11, 2026, 19:36 UTC
- Message-ID
- <CAHwyqnWspUTSnqmkMyXtWuAnENDSzrRLhhUR=Ljtt1xer3tphA@mail.gmail.com>
- In-Reply-To
- <CAHwyqnU0ifHu0+GfMR9GqWKgFrTOyQn-FbUH0wTm_07nCa26tA@mail.gmail.com>
Show 12 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, 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.
But there was a lot of discussion about this already, so I won't get into this again.
Harald