Re: [PATCH] revisions: add @{default} shorthand for default branch
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 2, 2026, 21:33 UTC
- Message-ID
- <xmqqa4xqygns.fsf@gitster.g>
- In-Reply-To
- <CALnO6CDrdfSFuY8xjvno3+2MVB2JHUYdNsYTYqqRsfcDiWa1uQ@mail.gmail.com>
"D. Ben Knoble" <ben.knoble@gmail.com> writes:
> If you don't need to be on a branch, then "git switch -d origin" (or > upstream, or whatever your remote is) should work just fine. > > That just makes discovering the name of the remote the "interesting" part…
The only thing that is different is if you need to _name_ a branch, or the commit pointed at is sufficient. In order to run something like "git shortlog origin..", "git shortlog @{default}.." is not needed.
Of course, checking out and to be on the branch requires you to name a branch (otherwise when two branches point at the same commit, you cannot tell which one you want to check out).