On Wed, May 8, 2013 at 3:04 PM, Petr Bena benapetr@gmail.com wrote:
Also note that in my document I have some hints like this:
Sometimes it's needed to use following, should you know why, feel free to explain it: git push origin HEAD:refs/publish/master
which I was told to use by someone else, and it works! So I noted it somewhere in case I would get into same issue again BUT I have no idea why it works. I just know it works and I don't know why. These things should be explained by expert, not me. But every notes of beginner in git or questions would greatly contribute to improve the documents
That's easy to explain, actually. This is what you're doing every time you submit stuff to Gerrit (and what the official Gerrit docs say to do).
`git push origin HEAD:refs/for/master`
So what this is saying is "Push to origin my HEAD commit, with the destination of refs/for/master." refs/for/foobar is the magic Gerrit ref for "This change is FOR the branch FOOBAR." HEAD doesn't have to be HEAD (it's just a pointer), you could just as easily refer to a random tag or sha1 in the same command. For example, let's say you wanted to push the change just before HEAD for review (but your HEAD wasn't ready), you could do:
`git push origin HEAD~1:refs/for/master`
git-review is nothing more than a wrapper around these commands (and a couple of other things) since people like less typing :)
Just for comparison, when you're doing a `git push origin master` (a la Github), you're actually just typing the shorthand version of `git push origin refs/heads/master:refs/heads/master.`
-Chad