Re: [PATCH] revisions: add @{default} shorthand for default branch
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 2, 2026, 22:28 UTC
- Message-ID
- <xmqqcy2mwzjy.fsf@gitster.g>
- In-Reply-To
- <d92bd08f-abee-49a6-89ad-3be5e0c06ad6@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 20 quoted lines
> ... Please
> correct me if I'm wrong but I think maybe what you're asking for is a
> shorthand for the branch "$b" where
>
> git push origin $b
>
> would update the remote tracking branch pointed to by "origin/HEAD".
> I've not really thought this through but if that is what you want maybe
> we could add "@{local}" to give that branch. Then, with the default
> refspecs and with "origin/HEAD" pointing to "origin/master",
> "origin@{local}" would be "refs/heads/master". If you created a feature
> branch with
>
> git checkout -b feature origin
>
> and you wanted to merge it into the local branch corresponding to the
> default branch on its upstream remote you could do
>
> git checkout feature@{upstream}@{local}
> git merge featureI do not know if that is what Harald is looking for, but I did wonder if we have use cases like that where we can string together multiple @{modifier} after a branch name. The @{local} thing that takes a remote-tracking branch and gives the local branch that would push to would be a "reverse" of @{push}; I wonder if three is need for a similar concept for a reverse of @{upstream} and if so, it would also be @{local-something-else}, and we may want to name this one not just @{local} but @{local-something}.
That "feature@{upstream}@{local}" notation is a great food for thought.
Thanks.