Home | Articles | CV (pdf)
<2012-08-01> by Lorenzo Bolla

Auto add reviewers in Gerrit

If you are using Gerrit for code review and project management of git-based projects, you might find yourself manually adding the same bunch of reviewers to your patches every single time.

In the past, I alleviated the problem with a simple Javascript bookmarklet: add it to your browser and click it while watching the patch in Gerrit.

But there's a better method: do it from command line, when pushing your local commits to Gerrit. Just add these lines to your .git/config:

pushurl = ssh://user@gerrit:29418/project
push = HEAD:refs/for/master
receivepack = git receive-pack --reviewer reviewer1 --reviewer reviewer2

Now, when you want to push a review, just do: git push review and "reviewer1" and "reviewer2" will be added to your patchset.