Search anything:

Open a pull request on Gerrit

Learn Algorithms and become a National Programmer
Indian Technical Authorship Contest starts on 1st July 2023. Stay tuned.

In this article, we have explained the detailed steps to open a pull request on Gerrit. The process is distinct from the process of opening a pull request on GitHub.

The difference in Gerrit is that git push command will open a new pull request for every commit on Gerrit. There is no concept of fork on Gerrit so no manual UI step is needed. So, be carefully to keep all changes for a single pull request on a single commit.

The steps to open a pull request on Gerrit:

  • Step 1: Make code changes.
  • Step 2: Add the changes
  • Step 3: Git commit the changes
  • Step 4: Push the commit
  • Step 5: Submit merge request for review

As the first step, you need to make code changes and add it using git.

Step 1: Make code changes.

For example, we have changed the file "info-opengenus.txt".

Step 2: Add the changes

git add .

Or specific files like:

git add info-opengenus.txt

Step 3: Git commit the changes

Use the command and fill in the details for commit message:

git commit -s
  • -s is to sign the commit

For each commit, you need to add the change ID which can be done as follows:

gitdir=$(git rev-parse --git-dir);
scp -p -P 92734 aditya@gerrit.opengenus.org:hooks/commit-msg ${gitdir}/hooks/
git commit --amend -s

Make sure to use your own port and hook URL.

To make further changes, we need to add the same changes in same commit so that command for the next set of changes will be:

git commit --amend -s

Step 4: Push the commit


git push origin HEAD:refs/for/master

This will open a work in progress pull request.

Step 5: Submit merge request for review

To open it for review, you need to add reviewers in the UI and submit it. Upon this, reviewers can review it by giving code review score and comments. You can click on the "Submit" button to merge your pull request.

This is how a pull request looks like on Gerrit:


We can open a pull request directly for review from the command line as well. For that, the command will be:

git push origin HEAD:refs/for/master%ready

Similarly, we can add reviewers, give code review score, comment and other activity through the command line directly. This can be easier if done from the User Interface (UI) for now.

With this article at OpenGenus, you must have the complete idea of how to open a pull request on Gerrit.

OpenGenus Tech Review Team

OpenGenus Tech Review Team

The official account of OpenGenus's Technical Review Team. This team review all technical articles and incorporates peer feedback. The team consist of experts in the leading domains of Computing.

Read More

Vote for Author of this article:

Improved & Reviewed by:

Aditya Chatterjee Aditya Chatterjee