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

Re: git-push: creating branch on remote, refspec format

From
Jeff King <peff@peff.net>
Date
Feb 26, 2009, 13:18 UTC
Message-ID
<20090226131826.GB7911@coredump.intra.peff.net>
In-Reply-To
<49A6863D.9000900@drmicha.warpmail.net>
On Thu, Feb 26, 2009 at 01:08:29PM +0100, Michael J Gruber wrote:
Show 8 quoted lines
> > $ git push /tmp/a master:foo
> [...]
> 
> You're using the very same form as the doc. "This form" in the doc
> refers to "repo refspec", i.e. something like "a b:c", which is what you
> use. The "refs/heads/" part is just there to disambiguate between
> possible different matches on the remote side (refs/heads/foo,
> refs/tags/foo, refs/remotes/bar/foo, ...).

Actually, it used to be that case that git would complain unless "foo" was properly qualified; this was fixed in f8aae12 (push: allow unqualified dest refspecs to DWIM, 2008-04-23), which is in v1.5.5.2.

The doc in question was added around v1.5.3. So I think it is simply that it was never updated to match the new behavior. That paragraph could probably even just be deleted, since there is no syntactic difference between pushing to an existing branch and creating a new branch (alternatively, it can say explicitly that creating a new branch is the same as pushing to one).

-Peff
Previous: Michael J Gruber
Message 3 of 3 in “git-push: creating branch on remote, refspec format”
  1. Lasse KliemannFeb 26, 2009
  2. Michael J GruberFeb 26, 2009
  3. Jeff KingFeb 26, 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.