{"thread":{"id":"18030","subject":"git-push: creating branch on remote, refspec format","startedAt":"2009-02-26T12:00:55Z","lastAt":"2009-02-26T13:18:26Z","messageCount":3,"participants":["Lasse Kliemann","Michael J Gruber","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"106319","messageId":"go609m$3dj$2@ger.gmane.org","threadId":"18030","inReplyTo":null,"subject":"git-push: creating branch on remote, refspec format","fromName":"Lasse Kliemann","fromEmail":"lasse-gmane-git-2009@mail.plastictree.net","sentAt":"2009-02-26T12:00:55Z","receivedAt":"2009-02-26T12:00:55Z","isPatch":false,"sender":{"key":"lasse-gmane-git-2009@mail.plastictree.net","avatar":null},"body":"http://www.kernel.org/pub/software/scm/git/docs/git-push.html reads:\n\n| git push origin master:refs/heads/experimental\n| \n|   Create the branch experimental in the origin repository by copying the \n|   current master branch. This form is only needed to create a new branch or \n|   tag in the remote repository when the local name and the remote name are \n|   different; otherwise, the ref name on its own will work.\n\nIt appears to me that the ref name on its own will also work to create a new \nbranch, at least with local repositories:\n\n$ (mkdir a && cd a && git init)\nInitialized empty Git repository in /tmp/a/.git/\n$ mkdir b && cd b && git init\nInitialized empty Git repository in /tmp/b/.git/\n$ pwd\n/tmp/b\n$ touch x && git add x && git commit \n[master (root-commit)]: created 87a90f5: \"NA\"\n 0 files changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 x\n\nNow the push from '/tmp/b' to '/tmp/a':\n\n$ git push /tmp/a master:foo\nCounting objects: 3, done.\nWriting objects: 100% (3/3), 209 bytes, done.\nTotal 3 (delta 0), reused 0 (delta 0)\nUnpacking objects: 100% (3/3), done.\nTo /tmp/a\n * [new branch]      master -> foo\n\nAm I missing something?\n"},{"id":"106320","messageId":"49A6863D.9000900@drmicha.warpmail.net","threadId":"18030","inReplyTo":"go609m$3dj$2@ger.gmane.org","subject":"Re: git-push: creating branch on remote, refspec format","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-02-26T12:08:29Z","receivedAt":"2009-02-26T12:08:29Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Lasse Kliemann venit, vidit, dixit 26.02.2009 13:00:\n> http://www.kernel.org/pub/software/scm/git/docs/git-push.html reads:\n> \n> | git push origin master:refs/heads/experimental\n> | \n> |   Create the branch experimental in the origin repository by copying the \n> |   current master branch. This form is only needed to create a new branch or \n> |   tag in the remote repository when the local name and the remote name are \n> |   different; otherwise, the ref name on its own will work.\n> \n> It appears to me that the ref name on its own will also work to create a new \n> branch, at least with local repositories:\n> \n> $ (mkdir a && cd a && git init)\n> Initialized empty Git repository in /tmp/a/.git/\n> $ mkdir b && cd b && git init\n> Initialized empty Git repository in /tmp/b/.git/\n> $ pwd\n> /tmp/b\n> $ touch x && git add x && git commit \n> [master (root-commit)]: created 87a90f5: \"NA\"\n>  0 files changed, 0 insertions(+), 0 deletions(-)\n>  create mode 100644 x\n> \n> Now the push from '/tmp/b' to '/tmp/a':\n> \n> $ git push /tmp/a master:foo\n> Counting objects: 3, done.\n> Writing objects: 100% (3/3), 209 bytes, done.\n> Total 3 (delta 0), reused 0 (delta 0)\n> Unpacking objects: 100% (3/3), done.\n> To /tmp/a\n>  * [new branch]      master -> foo\n> \n> Am I missing something?\n> \n\nYou're using the very same form as the doc. \"This form\" in the doc\nrefers to \"repo refspec\", i.e. something like \"a b:c\", which is what you\nuse. The \"refs/heads/\" part is just there to disambiguate between\npossible different matches on the remote side (refs/heads/foo,\nrefs/tags/foo, refs/remotes/bar/foo, ...).\n\nMichael\n"},{"id":"106322","messageId":"20090226131826.GB7911@coredump.intra.peff.net","threadId":"18030","inReplyTo":"49A6863D.9000900@drmicha.warpmail.net","subject":"Re: git-push: creating branch on remote, refspec format","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-02-26T13:18:26Z","receivedAt":"2009-02-26T13:18:26Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Feb 26, 2009 at 01:08:29PM +0100, Michael J Gruber wrote:\n\n> > $ git push /tmp/a master:foo\n> [...]\n> \n> You're using the very same form as the doc. \"This form\" in the doc\n> refers to \"repo refspec\", i.e. something like \"a b:c\", which is what you\n> use. The \"refs/heads/\" part is just there to disambiguate between\n> possible different matches on the remote side (refs/heads/foo,\n> refs/tags/foo, refs/remotes/bar/foo, ...).\n\nActually, it used to be that case that git would complain unless \"foo\"\nwas properly qualified; this was fixed in f8aae12 (push: allow\nunqualified dest refspecs to DWIM, 2008-04-23), which is in v1.5.5.2.\n\nThe doc in question was added around v1.5.3. So I think it is simply\nthat it was never updated to match the new behavior. That paragraph\ncould probably even just be deleted, since there is no syntactic\ndifference between pushing to an existing branch and creating a new\nbranch (alternatively, it can say explicitly that creating a new branch\nis the same as pushing to one).\n\n-Peff\n"}]}