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, 16:11 UTC
Message-ID
<20090303161117.GB32079@coredump.intra.peff.net>
In-Reply-To
<450196A1AAAE4B42A00A8B27A59278E709F075DF@EXCHANGE.trad.tradestation.com>
On Tue, Mar 03, 2009 at 10:52:21AM -0500, John Dlugosz wrote:
Show 7 quoted lines
> But I wonder if some commands work differently or specifically don't
> look in remotes.  I "learned" to qualify everything when I accidently
> created a local branch named pub/xxx instead of using remotes/pub/xxx
> like I intended.  I don't remember what that was, but I'm guessing
> that maybe refs that are a destination are different, as you are only
> supposed to change your local stuff.  I think that was a "pull"
> command, before I had the automatic argument in the config file.

Yes, the "branch" command deals only with creating things in refs/heads, which are your local branches (similarly, "git tag" will only deal with stuff in refs/tags). So "git branch origin/foo" will make a ref "refs/heads/origin/foo", and "git branch -d origin/foo" will delete "refs/heads/origin/foo", not "refs/remotes/origin/foo".

But when looking up a ref, the rules are used. So you can say:
  git branch master origin/master
which will make "refs/heads/master" from "refs/remotes/origin/master".
-Peff
Previous: John DlugoszNext: Jay Soffian
Message 7 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.