Git push vs git push

June 19, 2018

Recently I’ve been using gerrit as a version control tool. I was taking it for granted that gerrit is some sort of github. But unfortunately, it is not. Gerrit has its own logical way of managing the version. One example is git push.

In github, I use git push origin <branch_name> for push changes to the remote repo where the branch_name is just simply the same name as remote like master or dev. However in gerrit, git push origin dev does not work instead of git push origin HEAD:refs/for/dev. Bellow is the way how gerrit work:

Obviously, gerrit fake the remote branch so that the reviewer could review the changes in the repo and confirm to push to the real remote for CI test.

Reference

https://stackoverflow.com/questions/10461214/why-is-git-push-gerrit-headrefs-for-master-used-instead-of-git-push-origin-mast