git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: chris <jugg@hotmail.com>
To: git@vger.kernel.org
Subject: Re: error with $ git push origin HEAD:newbranch
Date: Tue, 10 May 2011 15:34:26 +0000 (UTC)	[thread overview]
Message-ID: <loom.20110510T153328-584@post.gmane.org> (raw)
In-Reply-To: 20110506170204.GA16576@sigill.intra.peff.net

Jeff King <peff <at> peff.net> writes:
> 
> On Fri, May 06, 2011 at 02:16:03AM +0000, chris wrote:
> 
> > Personally, I would prefer that git-push work on branches by default[1], 
> > providing shortcuts for pushing tag[2] refs and remote branch[3] refs, 
> > while all other ref types must be called out explicitly.  Creating new refs 
> > isn't destructive, so it seems these could be supported without concern.
> > 
> > 1. $ git push origin SHA1:branch1
> >   => $ git push origin SHA1:refs/heads/branch1
> > 
> > 2. $ git push origin tag SHA1:tagname
> >   => $ git push origin SHA1:refs/tags/tagname
> > 
> > 3. $ git push origin SHA1:upstream/branch2
> >   => $ git push origin SHA1:refs/remotes/upstream/branch2
> 
> In (3), how do you differentiate between the branch
> "refs/heads/upstream/branch2" and the remote tracking branch
> "refs/remotes/upstream/branches"?

I was just taking a queue from the documentation:

--
"git push origin master:satellite/master dev:satellite/dev

Use the source ref that matches master (e.g. refs/heads/master) to update the
ref that matches satellite/master (most probably refs/remotes/satellite/master)
in the origin repository, then do the same for dev and satellite/dev."
--

Of course the documentation there is meaninging that
refs/remotes/satellite/master already exists and that there is no conflicting
refs/heads/satellite/master.

Probably what I need to do is better understand the "guess work" git-push
already does before trying to "improve" it.  So, based on this thread and the
documentation, the following holds true:

  $ git push origin HEAD:newbranch

is valid only if HEAD contains a branch ref pointer.  Otherwise, if the LHS of
the refspec is not a known ref type, the RHS must always be explicit when
pushing a new ref.  If the LHS is a known ref type, then the same ref type is
used for the RHS of the refspec - also the RHS becomes optional in such a case
and the LHS name will be used if the RHS was omitted.

If that is a correct summary (something missing?), then as is, there is little
point in anything but explicit specification of the RHS of the refspec when
pushing a new ref.

And given that "$ git push remote tag <refspec>" syntax seems to be outdated, I
don't see any benefit to my proposed set of shortcuts for pushing new refs.

So, thanks Peff for the informative responses, they helped bring my
understanding up a notch.

chris

  reply	other threads:[~2011-05-10 15:34 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
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 [this message]
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=loom.20110510T153328-584@post.gmane.org \
    --to=jugg@hotmail.com \
    --cc=git@vger.kernel.org \
    /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).