Jeff King <peff <at> peff.net> writes: > > On Tue, May 10, 2011 at 03:34:26PM +0000, chris wrote: > > > > > $ 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. > > I think the RHS is always optional, isn't it? That is, if I say: > > git push origin foo > > then that is always equivalent to > > git push origin foo:foo > > which will then push to the matching "foo" on the remote; if it does not > exist, then it will infer the type of "foo" on the remote from the type > of "foo" locally. But I could be mis-remembering, as it's been a while > since I've dug into the refspec code. Yes, but I was distinguishing when the LHS is not a known ref type $ git push origin HEAD^ isn't valid. So, my meaning was RHS only becomes optional if the LHS resolves to a local ref. Which may be obvious; I was just trying to cover the use cases. I think the generalization is that git-push tries to build the refspec using hints from the local ref part. If it can not do so, it fails rather than defaulting to any particular behavior. chris -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html