git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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 feature

I 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.
Previous: Phillip WoodNext: Harald Nordgren via GitGitGadget
Message 28 of 32 in “revisions: add @{default} shorthand for default branch”
  1. revisions: add @{default} shorthand for default branchHarald Nordgren via GitGitGadget, Jan 29, 2026
  2. Junio C HamanoJan 29, 2026
  3. Harald NordgrenJan 30, 2026
  4. Harald NordgrenJan 30, 2026
  5. Junio C HamanoJan 30, 2026
  6. Harald NordgrenJan 30, 2026
  7. Junio C HamanoJan 30, 2026
  8. Harald NordgrenJan 31, 2026
  9. Junio C HamanoJan 31, 2026
  10. Harald NordgrenJan 31, 2026
  11. Harald NordgrenJan 31, 2026
  12. Junio C HamanoFeb 2, 2026
  13. Harald NordgrenFeb 2, 2026
  14. Phillip WoodFeb 2, 2026
  15. Harald NordgrenFeb 2, 2026
  16. D. Ben KnobleFeb 2, 2026
  17. Harald NordgrenFeb 2, 2026
  18. Kristoffer HaugsbakkFeb 2, 2026
  19. Ben KnobleFeb 2, 2026
  20. Harald NordgrenFeb 2, 2026
  21. Junio C HamanoFeb 2, 2026
  22. Ben KnobleFeb 2, 2026
  23. Harald NordgrenFeb 2, 2026
  24. Junio C HamanoFeb 2, 2026
  25. Harald NordgrenFeb 2, 2026
  26. Harald NordgrenFeb 3, 2026
  27. Phillip WoodFeb 3, 2026
  28. Junio C HamanoFeb 2, 2026
  29. revisions: add @{default} shorthand for default branchHarald Nordgren via GitGitGadget, Jan 30, 2026
  30. Kristoffer HaugsbakkJan 30, 2026
  31. revisions: add @{primary} shorthand for primary branchHarald Nordgren via GitGitGadget, Jan 30, 2026
  32. revisions: add @{primary} shorthand for primary branchHarald Nordgren via GitGitGadget, Jan 31, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.