Avoiding a deep rebase when posting a patch

OpenStack Milestone Icehouse 2 (I2) is due this Tuesday. The gate is deep and the penalty for messing it up is costly. I recently had to update a patch that depends on three patches that are approved but but not merged to master. Using the git review command line, all 5 patches would get resubmitted. This was too high a risk for me.

Gerrit does magic. When you post a patch to Gerrit, it does not got directly to the branch. You post to a ref, and Gerrit then performs additional workflow before creating a new ref. This is so that the old refs are accessible for review, and also so that a user can’t create an invalid reference.

To avoid accidentally rebasing the earlier patches, and triggering a dump of all the work in the gate queue, I wanted to replicate what Gerrit does without pushing updates to the dependencies.

To push an updated patch, find the the Download URL on the review using the ssh protocol, and remove the revision number. Push a new version to that reference (using the ssh protocol). For example, from a recent review at version 18. This command:

git push ssh://ayoung@review.openstack.org:29418/openstack/keystone revocation-events:refs/changes/08/55908

pushed a new version of the patch which now shows as revision 19: revocation-events:refs/changes/08/55908/19

Thanks to YorikSar (Yuriy Taraday)
Better way to do it (assuming the branch is checked out)

git push gerrit HEAD:refs/for/master