{"thread":{"id":"9798","subject":"[PATCH] Include a git-push example for creating a remote branch","startedAt":"2007-09-06T04:44:08Z","lastAt":"2007-09-06T17:42:08Z","messageCount":9,"participants":["Shawn O. Pearce","Miles Bader","Junio C Hamano","Wincent Colaiuta","Kristian Høgsberg","Carl Worth"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"52685","messageId":"20070906044408.GA588@spearce.org","threadId":"9798","inReplyTo":null,"subject":"[PATCH] Include a git-push example for creating a remote branch","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-09-06T04:44:08Z","receivedAt":"2007-09-06T04:44:08Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Many users get confused when `git push origin master:foo` works\nwhen foo already exists on the remote repository but are confused\nwhen foo doesn't exist as a branch and this form does not create\nthe branch foo.\n\nThis new example highlights the trick of including refs/heads/\nin front of the desired branch name to create a branch.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n Documentation/git-push.txt |    6 ++++++\n 1 files changed, 6 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-push.txt b/Documentation/git-push.txt\nindex 0dd9caf..7b8e075 100644\n--- a/Documentation/git-push.txt\n+++ b/Documentation/git-push.txt\n@@ -117,6 +117,12 @@ git push origin master:satellite/master::\n \tthe ref that matches `satellite/master` (most likely, it would\n \tbe `refs/remotes/satellite/master`) in `origin` repository with it.\n \n+git push origin master:refs/heads/experimental::\n+\tCreate the branch `experimental` in the `origin` repository\n+\tby copying the current `master` branch.  This form is usually\n+\tneeded to create a new branch in the remote repository as\n+\tthere is no `experimental` branch to match.\n+\n Author\n ------\n Written by Junio C Hamano <junkio@cox.net>, later rewritten in C\n-- \n1.5.3.1.840.g0fedbc\n"},{"id":"52687","messageId":"buoodggo0l2.fsf@dhapc248.dev.necel.com","threadId":"9798","inReplyTo":"20070906044408.GA588@spearce.org","subject":"Re: [PATCH] Include a git-push example for creating a remote branch","fromName":"Miles Bader","fromEmail":"miles.bader@necel.com","sentAt":"2007-09-06T04:54:33Z","receivedAt":"2007-09-06T04:54:33Z","isPatch":true,"sender":{"key":"miles.bader@necel.com","avatar":"https://gravatar.com/avatar/be062d4050eb88e04229cbdb60f803e1bd647923a015996c2439e76f23e336a7?d=mp&s=160"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n> Many users get confused when `git push origin master:foo` works\n> when foo already exists on the remote repository but are confused\n> when foo doesn't exist as a branch and this form does not create\n> the branch foo.\n\nHmm, what _does_ it do in that case...?\n\n-Miles\n\n-- \nIf you can't beat them, arrange to have them beaten.  [George Carlin]\n"},{"id":"52689","messageId":"20070906050127.GS18160@spearce.org","threadId":"9798","inReplyTo":"buoodggo0l2.fsf@dhapc248.dev.necel.com","subject":"Re: [PATCH] Include a git-push example for creating a remote branch","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-09-06T05:01:27Z","receivedAt":"2007-09-06T05:01:27Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Miles Bader <miles.bader@necel.com> wrote:\n> \"Shawn O. Pearce\" <spearce@spearce.org> writes:\n> > Many users get confused when `git push origin master:foo` works\n> > when foo already exists on the remote repository but are confused\n> > when foo doesn't exist as a branch and this form does not create\n> > the branch foo.\n> \n> Hmm, what _does_ it do in that case...?\n\nerror: dst refspec experimental does not match any existing ref on the remote and does not start with refs/.\n\n-- \nShawn.\n"},{"id":"52695","messageId":"fc339e4a0709052257m4ddc5784obe64a8b75b79b19@mail.gmail.com","threadId":"9798","inReplyTo":"20070906050127.GS18160@spearce.org","subject":"Re: [PATCH] Include a git-push example for creating a remote branch","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2007-09-06T05:57:26Z","receivedAt":"2007-09-06T05:57:26Z","isPatch":true,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"On 9/6/07, Shawn O. Pearce <spearce@spearce.org> wrote:\n> Miles Bader <miles.bader@necel.com> wrote:\n> > > Many users get confused when `git push origin master:foo` works\n> > > when foo already exists on the remote repository but are confused\n> > > when foo doesn't exist as a branch and this form does not create\n> > > the branch foo.\n> >\n> > Hmm, what _does_ it do in that case...?\n>\n> error: dst refspec experimental does not match any existing ref on the remote and does not start with refs/.\n\nHmm, I'm assuming people don't want to default to just creating a new\nremote ref ('cause it might be too easy to muck up a remote archive\nthat way), but it seems like it would be nice to have a \"prettier\" way\nto create a remote ref than explicitly giving the whole ref path on\nthe remote side.\n\nMaybe I\"m weird, but I tend to think of the refs/... syntax as being\nfor \"only if you're doing something funny\" cases.\n\nI'm thinking of something like:\n\n  ... create new local branch \"zoink\" ...\n  git push --create origin zoink\n\n-Miles\n\n-- \nDo not taunt Happy Fun Ball.\n"},{"id":"52704","messageId":"7v8x7ke260.fsf@gitster.siamese.dyndns.org","threadId":"9798","inReplyTo":"fc339e4a0709052257m4ddc5784obe64a8b75b79b19@mail.gmail.com","subject":"Re: [PATCH] Include a git-push example for creating a remote branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-09-06T06:30:31Z","receivedAt":"2007-09-06T06:30:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Miles Bader\" <miles@gnu.org> writes:\n\n> Maybe I\"m weird, but I tend to think of the refs/... syntax as being\n> for \"only if you're doing something funny\" cases.\n\nThe \"refs/\" syntax is there as the lowest level that is\nuniversally usable to create and any ref.  It can be used to\npush to branches, tags, or even remotes (aka \"simulated fetch in\nreverse\").\n\nIt is just nobody felt strong enough reason to sugarcoat the\nnormalized syntax with something like:\n\n\tgit push --create remote foo v1.2.0\n\nYou can be a hero by updating git-push to take such, and make it\ninterpret as if the user passed the normalized syntax which is:\n\n\tgit push remote foo:refs/heads/foo v1.2.0:refs/tags/v1.2.0\n"},{"id":"52731","messageId":"A3C344D0-B2A0-44DC-BCBD-3B2C1EBD24B1@wincent.com","threadId":"9798","inReplyTo":"20070906044408.GA588@spearce.org","subject":"Re: [PATCH] Include a git-push example for creating a remote branch","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2007-09-06T10:50:30Z","receivedAt":"2007-09-06T10:50:30Z","isPatch":true,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 6/9/2007, a las 6:44, Shawn O. Pearce escribió:\n\n> +git push origin master:refs/heads/experimental::\n> +\tCreate the branch `experimental` in the `origin` repository\n> +\tby copying the current `master` branch.  This form is usually\n> +\tneeded to create a new branch in the remote repository as\n> +\tthere is no `experimental` branch to match.\n> +\n\nA welcome addition; I was puzzled the first time I tried this myself  \ntoo.\n\nCheers,\nWincent\n"},{"id":"52760","messageId":"1189090638.3423.0.camel@hinata.boston.redhat.com","threadId":"9798","inReplyTo":"A3C344D0-B2A0-44DC-BCBD-3B2C1EBD24B1@wincent.com","subject":"Re: [PATCH] Include a git-push example for creating a remote branch","fromName":"Kristian Høgsberg","fromEmail":"krh@redhat.com","sentAt":"2007-09-06T14:57:18Z","receivedAt":"2007-09-06T14:57:18Z","isPatch":true,"sender":{"key":"krh@redhat.com","avatar":"https://gravatar.com/avatar/763dee6f9594ac474f725b137a39565792928e583ddf59b32befc2907409027e?d=mp&s=160"},"body":"On Thu, 2007-09-06 at 12:50 +0200, Wincent Colaiuta wrote:\n> El 6/9/2007, a las 6:44, Shawn O. Pearce escribió:\n> \n> > +git push origin master:refs/heads/experimental::\n> > +\tCreate the branch `experimental` in the `origin` repository\n> > +\tby copying the current `master` branch.  This form is usually\n> > +\tneeded to create a new branch in the remote repository as\n> > +\tthere is no `experimental` branch to match.\n> > +\n> \n> A welcome addition; I was puzzled the first time I tried this myself  \n> too.\n\nIndeed, but a even better approach might be to expand the error message\nwith a sugestion on how to create a branch.\n\nKristian\n"},{"id":"52766","messageId":"874pi7dcba.wl%cworth@cworth.org","threadId":"9798","inReplyTo":"7v8x7ke260.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Include a git-push example for creating a remote branch","fromName":"Carl Worth","fromEmail":"cworth@cworth.org","sentAt":"2007-09-06T15:48:57Z","receivedAt":"2007-09-06T15:48:57Z","isPatch":true,"sender":{"key":"cworth@cworth.org","avatar":"https://gravatar.com/avatar/3746dc28cde609bdbd7f939058356e7e2bbd16d21e32274df0725eb3d998bc5b?d=mp&s=160"},"body":"On Wed, 05 Sep 2007 23:30:31 -0700, Junio C Hamano wrote:\n> It is just nobody felt strong enough reason to sugarcoat the\n> normalized syntax with something like:\n>\n> \tgit push --create remote foo v1.2.0\n\nCouldn't we just use an initial + to indicate this as well?\n\nI would imagine an exchange like this:\n\n    $ git push remote foo\n    git: No branch 'foo' exists in the remote server, to create it use:\n\n\tgit push remote +foo\n\nBut regardless of the syntax, it would be nice if the error message\nwere explicit about how to achieve the goal the user wants. It's just\nthat forcing the user to say \"foo:refs/heads/foo\" seems a way to force\nthe user to get plumbing grime on their clean hands.\n\n-Carl\n"},{"id":"52785","messageId":"7vps0vadxr.fsf@gitster.siamese.dyndns.org","threadId":"9798","inReplyTo":"874pi7dcba.wl%cworth@cworth.org","subject":"Re: [PATCH] Include a git-push example for creating a remote branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-09-06T17:42:08Z","receivedAt":"2007-09-06T17:42:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Carl Worth <cworth@cworth.org> writes:\n\n> On Wed, 05 Sep 2007 23:30:31 -0700, Junio C Hamano wrote:\n>> It is just nobody felt strong enough reason to sugarcoat the\n>> normalized syntax with something like:\n>>\n>> \tgit push --create remote foo v1.2.0\n>\n> Couldn't we just use an initial + to indicate this as well?\n\nUnfortunately, no, because + has already been taken to mean\nsomething completely different.\n"}]}