Re: Friendly refspecs
- From
Jeff King <peff@peff.net>
- Date
- Apr 16, 2008, 03:48 UTC
- Message-ID
- <20080416034823.GA11727@sigill.intra.peff.net>
- In-Reply-To
- <20080413093102.GC12107@mithlond.arda.local>
On Sun, Apr 13, 2008 at 12:31:02PM +0300, Teemu Likonen wrote:
Show 14 quoted lines
> There is still one thing (at least) that I don't quite understand. It's > about "git push". When I do > > $ git push <remote> <branch> > > the refs/heads/<branch> is updated or created on the remote side. But if > I do > > $ git push <remote> <branch1>:<branch2> > > the refs/heads/<branch2> is not automatically created. Why there is need > to say "<branch1>:refs/heads/<branch2>" to make it work if <branch2> > does not exist? The 'git push' manual says something vague about branch > not matching (?). What does it mean?
This happens because "git push <remote> <branch>" is expanded locally to "git push <remote> <branch>:<branch>", but <branch> is first expanded into refs/heads/<branch>.
The latter uses the explicit refspec <branch2> which doesn't get expanded, since it doesn't exist at all, and so we can't deduce the type (e.g., refs/heads versus refs/tags).
ISTR some discussion in the past few months about using the type of <branch1> to guess the type of <branch2>, but it seems not to have gone anywhere.
Daniel, were you working on this?
-Peff