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

Re: remote branches, and branch names in general

From
Jeff King <peff@peff.net>
Date
Mar 3, 2009, 04:16 UTC
Message-ID
<20090303041631.GB18136@coredump.intra.peff.net>
In-Reply-To
<m3vdqrtp84.fsf@localhost.localdomain>
On Mon, Mar 02, 2009 at 04:38:42PM -0800, Jakub Narebski wrote:
Show 8 quoted lines
> > I see the remote branches with names of the form remotes/pub/name where
> > pub is the nickname of the place I pull from.  To specify such branches,
> > must I always spell it out with the leading "remotes/", or can that be
> > shorted or implied somehow?  
> 
> You usually can omit "remotes/" prefix, and just use
> "<remote>/<branch>" (or even "<remote>" for "<remote>/HEAD"). You need
> it only if there is need for disambiguation.

Yes. I don't know if they are documented anywhere, but the complete lookup order is:

  $ git grep -h -A8 ref_rev_parse_rules refs.c
  const char *ref_rev_parse_rules[] = {
          "%.*s",
          "refs/%.*s",
          "refs/tags/%.*s",
          "refs/heads/%.*s",
          "refs/remotes/%.*s",
          "refs/remotes/%.*s/HEAD",
          NULL
  };
-Peff
Previous: Jakub NarebskiNext: Markus Heidelberg
Message 3 of 9 in “remote branches, and branch names in general”
  1. John DlugoszMar 2, 2009
  2. Jakub NarebskiMar 3, 2009
  3. Jeff KingMar 3, 2009
  4. Markus HeidelbergMar 3, 2009
  5. Jeff KingMar 3, 2009
  6. John DlugoszMar 3, 2009
  7. Jeff KingMar 3, 2009
  8. Jay SoffianMar 3, 2009
  9. Jeff KingMar 4, 2009

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.