Re: [RFC] branch: delete gone-upstream branches only when proven merged into a named ref
- From
D. Ben Knoble <ben.knoble@gmail.com>
- Date
- Oct 24, 2026, 13:14 UTC
- Message-ID
- <CALnO6CAxzo5gxpWkfjtvskTVjmWWD4oFE2QKyFMMo7JZUCkBmg@mail.gmail.com>
- In-Reply-To
- <CAHwyqnWi3MCvAw-sNrn6k3ht1tpUfmNg18BAvEThKthen5Dwmw@mail.gmail.com>
On Thu, Oct 22, 2026 at 9:44 AM Harald Nordgren <haraldnordgren@gmail.com> wrote:
Show 30 quoted lines
>
> > Ah, but the manual seems to contradict my (personal) "natural" reading
> > of the command: "--delete-merged" actually deletes branches whose tip
> > is reachable from their upstream (when that upstream matches the given
> > pattern). So, phooey. In this case, if "topic@{upstream}" was
> > "origin/master", though, "--delete-merged=origin/*" would work, no?
> > Incidentally, I find it a shame that GitHub's documentation encourages
> > a triangular workflow (whether or not there is a fork remote involved)
> > without talking about how to configure Git to help you: fork or not,
> > if you push to a topic branch but merge to another, it's extremely
> > handy to use push.default=current or some variant so that
> >
> > - @{upstream} is the place you'll merge
> > - @{push} is the place you push
> >
> > and suddenly "git pull [--rebase]" does the right thing, "git status"
> > (esp. with the new "status.compareBranches") can tell you where you
> > are relative to both places of interest, etc.
> >
> > IOW, "git push -u origin topic" makes upstream configuration very odd
> > in the GitHub-ish workflow!
>
> Fully agree!
>
> I would say most workflows are triangular on the underlying level,
> even if the developer is not aware of it. If you work with GitHub PRs
> or GitLab's MR, then you are engaging in a triangular workflow.
>
> I picked up some important tricks for visualizing the triangular on
> this mailing list. But most of our users are not on the mailing list.Yep. Maybe I'll start writing a "triangular workflow" document à la Julia's work… going on the todo list, at any rate.
Show 6 quoted lines
> But what we can and should do is to make git itself clearer, so they > have a chance of intuiting it. I think for example that > > push.default=current > > should likely be the default.
IIUC, the last change in this area was controversial. I worry that changes here now would have to get through "scar tissue" (both of Git contributors *and* users). At any rate, it would probably want to be a major version release, and I understand it's probably too late to discuss flipping that in 3.0?
Show 6 quoted lines
> And many people would have a better time with
>
> branch.autosetupmerge=inherit
>
> which gives you upstream/master as @{u} from the beginning, and then
> you likely never abandon that if you are a regular GitHub user.Hm. Since I mostly do
git switch -c topic origin
or similar, I'm ok with the default (=true). With inherit, the primary help is to folks who do
git switch -c topic main
or something, right? But the documentation doesn't say what happens when inherit is used with a remote-tracking branch as a starting point (which has no upstream to copy from).
Show 8 quoted lines
> This is also why I feel strongly about this as default
> (https://lore.kernel.org/git/pull.2458.git.git.1792437798463.gitgitgadget@gmail.com/):
>
> status.comparebranches=@{upstream} @{push}
>
> because it's confusing to switch tracking away from your "own branch"
> to upstream/master, if that means losing the waypoint of how things
> compare against @{push}.Yeah, I'll try and reply in that thread shortly.
-- D. Ben Knoble