My workplace started using Gerrit to manage all of our projects. I've never used Gerrit before. I'm trying to figure out a good workflow for using it for submitting code for review.
I created a branch foo
. I made a commit on it, and pushed it to Gerrit. Then I started a branch bar
starting from foo
, and made another commit on it. I pushed the branch bar
to Gerrit as well.
I am now on branch bar
:
$ git branch
* bar
foo
Now I wanted to start a code review for a merge from bar
to foo
. I was told that this command should do it:
$ git push gerrit HEAD:refs/for/foo
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: Processing changes: refs: 1, done
To ssh://ram@gerrit/acme/my_project
! [remote rejected] HEAD -> refs/for/foo (no new changes)
error: failed to push some refs to 'ssh://ram@gerrit/acme/my_project'
As you can see, I'm getting the error (no new changes)
. I asked our local Gerrit champion why, and he says that as far as he knows, you can't push for code review code that's already on Gerrit, even if that code is on a different branch.
It looks like if I'd avoid pushing the branch bar
to Gerrit, my problem would go away and the code review would work. But I would prefer to be able to push whatever the %&@# I want without it interfering with code reviews. I like pushing branches. I like having my branches on Gerrit, because then I can also send them to other people to see on the web interface.
Is it possible to make code reviews in Gerrit work without forbidding me from pushing my branches to Gerrit?