git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: chris <jugg@hotmail.com>
Cc: git@vger.kernel.org
Subject: Re: error with $ git push origin HEAD:newbranch
Date: Thu, 5 May 2011 06:59:14 -0400	[thread overview]
Message-ID: <20110505105914.GA464@sigill.intra.peff.net> (raw)
In-Reply-To: <loom.20110505T114511-660@post.gmane.org>

On Thu, May 05, 2011 at 10:06:21AM +0000, chris wrote:

> Yes, indeed.  I suppose it must be the situation that I've never done that
> before then.  While I certainly I have pushed a detached head before, it must 
> have always been to an existing branch.
> 
> Thanks for clarifying this.
> 
> It is slightly surprising that git-push doesn't default to assuming one means 
> refs/heads/newbranch in this case.  I don't see a reason not to?

Consider something like:

  $ git checkout v1.5
  $ git push origin HEAD:foo

Would you want "foo" to be a branch or a tag? I can see arguments for
either.

Rather than trying to guess, it's fairly easy to disambiguate. For a
branch, either:

  $ git push origin HEAD:refs/heads/foo

or

  $ git branch foo
  $ git push origin HEAD

would work, depending on whether or not you want a local branch.

-Peff

  reply	other threads:[~2011-05-05 10:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05  8:47 error with $ git push origin HEAD:newbranch chris
2011-05-05  9:37 ` Jeff King
2011-05-05 10:06   ` chris
2011-05-05 10:59     ` Jeff King [this message]
2011-05-06  2:16       ` chris
2011-05-06  4:56         ` Junio C Hamano
2011-05-06  6:35           ` chris
2011-05-06 17:02         ` Jeff King
2011-05-10 15:34           ` chris
2011-05-10 19:47             ` Jeff King
2011-05-11 10:10               ` chris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110505105914.GA464@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=jugg@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).