Subject: Re: [PATCH] status: show default branch comparison when tracking non-default branch

From: Junio C Hamano <[email-masked]>
Date: Tue, 23 Dec 2025 22:32:49 +0900

Harald Nordgren <[email-masked]> writes:

>> You seem to be using the "what would a new user get when they clone
>> the remote (by virtue of their HEAD pointing at that branch)", but
>> I am not sure if that is a good way to determine the other remote
>> thing to compare with.
>>
>> Even if one remote branch you pull from (but not push to) has a name
>> that is not one of those usual ones like 'main', 'master', 'trunk',
>> 'default'
>
> Agreed, this should be as agnostic as possible. "Default" might be
> me using GitHub terminology. However, it seems that 'git
> symbolic-ref refs/remotes/upstream/HEAD' always produces the
> desires result, so for the sake of discussion we can call it
> "upstream/HEAD" instead of "default".

I didn't exactly question the terminology, but was wondering more
about the wisdom of using remotes/*/HEAD.

If a project uses the same remote repository to maintain its
maintenance and development tracks, their HEAD might point at the
'main' (used for development), but some of your branches you used to
work on fixes that can later be merged to the maintenance track, it
is likely that you'll fork from their 'maint', and while you keep
polishing your fixes, you may push your 'fix' branch to their 'fix'
branch.  Comparing your 'fix' with their 'fix' is what we already
do, and it gives two thirds of what you need, but the missing
comparison is with their 'maint', not with their HEAD that points at
their 'main'.

Thanks.