Jump to navigation Jump to search
This is a tutorial how to use Git and Gerrit for MediaWiki development. It includes explanations. For a very short how-to guide, see Gerrit/Tutorial/tl;dr instead.

This tutorial explains how to:

  • set up and configure Git on your machine (to check out code repositories)
  • set up Gerrit access (for code review)
  • install git-review (to propose patches for code review)
  • submit a patch (changeset) for review
  • understand the MediaWiki code review process (commit, review, merge)

For power users, Gerrit/Advanced usage has additional documentation.

If you want to learn how to use Gerrit, use our Gerrit test instance instead.

What is Git?[edit]

Git Basics #1: What is a Version Control System (VCS)?

Git is a free and open source distributed version control system. It is written in C originally developed by Linus Torvalds and others to manage the Linux kernel. “Distributed” means that there is no central copy of the repository. With Subversion (which was used by Wikimedia before moving to Git), Wikimedia’s servers host the repository and users commit their changes to it. In contrast, with Git, once you’ve cloned the repository, you have a fully functioning copy of the source code, with all the branches and tagged releases at your disposal.

What is Gerrit?[edit]

Gerrit is a free, web-based collaborative code review tool that integrates with Git. It is written in Java (Java EE Java Servlet) and has been developed at Google by Shawn Pearce for the development of the Android project.

Setting up Git[edit]

Git Basics #2: What is Git?

These instructions explain how to install Git as a command-line (terminal window) tool. If you prefer a graphical user interface (GUI) check the list of clients maintained by the Git project. For alternate installation instructions look here, or here.


Linux & UNIX[edit]

Installing git on Ubuntu

Using the graphical software package management tool of your Linux distribution to install Git is recommended.

If you prefer using the command line in a terminal:

  • Debian/Ubuntu: sudo apt-get install git
  • Fedora: dnf install git (or yum install git on Fedora≤21 and CentOS)
  • archlinux: pacman -S git
  • openSUSE: zypper install git
  • Gentoo: emerge --ask --verbose dev-vcs/git
  • FreeBSD: cd /usr/ports/devel/git; make install
  • NetBSD: cd /usr/pkgsrc/devel/scmgit/; make install
  • OpenBSD: pkg_add git
  • Solaris 11 Express: pkg install developer/versioning/git
  • Mageia: urpmi git

For other Linux distributions please check your vendor documentation.


Install Git for Windows from This gives you Git, plus a shell that allows most of the command lines in these instructions to work on Windows. See also Gerrit/TortoiseGit tutorial.

OS X[edit]

Install one of the following:

  • Homebrew package manager: brew install git – Recommended, simple updating and easy installing of other packages
  • Standalone: Git for Mac

Configure Git[edit]

Git Basics #3: Get Going

Now that you have Git installed, it’s time to configure your personal information. You should have to do these things only once; they’ll stick around between upgrades. You can also change them at any time by running through the commands again.

Git comes with a tool called git config that lets you get and set configuration variables that control all aspects of how Git looks and behaves. To see your current configuration use the "list" -l option:

git config -l
Tournesol.png Example:

Set your username and email[edit]

Git tracks who makes each commit by checking the user’s name and email. In addition, this info is used to associate your commits with your Gerrit account. To set these, enter the two commands below by replacing the name and email address with your own.

 git config --global ""
 git config --global "example"
Tournesol.png Example:

Set Up SSH Keys in Gerrit[edit]

We use SSH keys to establish a secure connection between your computer and Gerrit. Setting them up involves a number of steps. Run the following commands in a terminal. For alternate instructions, see here, and then here.

To make sure whether you need to generate a brand new key, you need to check if one already exists. List the files in your .ssh directory (if you have one):

ls ~/.ssh

If you see a file called here, you may skip right to #Add your SSH key.

Generate a new SSH key[edit]

To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.

Output of the ssh-keygen command
ssh-keygen -t rsa -C ""

Assign a memorable passphrase and press [enter].

Why do passphrases matter?
Passwords aren’t very secure. If you use one that’s easy to remember, it’s easier to guess or brute-force (try many options until one works). If you use one that’s random it’s hard to remember, and thus you’re more inclined to write the password down. Both of these are Very Bad Things™. This is why you’re using ssh keys.
But using a key without a passphrase is basically the same as writing down that random password in a file on your computer. Anyone who gains access to your drive has gained access to every system you use that key with. This is also a Very Bad Thing™. The solution is obvious: add a passphrase.
But I don’t want to enter a long passphrase every time I use the key!
Neither do we! Thankfully, there’s a tool called ssh-agent that can save your passphrase securely so you don’t have to re-enter it. If you’re on Mac OS X Leopard or later or recent Linux distributions your keys can be saved in the system’s keychain to make your life even easier.

It will create 2 files in ~/.ssh directory as follows:

~/.ssh/id_rsa : identification (private) key
~/.ssh/ : public key

Add your SSH key[edit]

Open your public key file, (e.g. with a text editor (Notepad, TextEdit, or gedit will do just fine). You may need to turn on “View hidden files” to find it because the .ssh directory is hidden. It’s important you copy your SSH key exactly as it is written without adding any newlines or whitespace. Copy the full text, including the "ssh-rsa" prefix, the key itself, and the email address suffix.

On a Linux system you can use the following:

cat ~/.ssh/

If you cannot view hidden files, there are other ways to copy:


sudo apt-get install xclip # Downloads and installs xclip
xclip -sel clip < ~/.ssh/

You can open Git GUI, go to Help > Show Key, and then press Copy To Clipboard to copy your public key to your clipboard.

Mac OS X:

pbcopy < ~/.ssh/ # Copies the contents of the file to your clipboard

Add SSH key to your Gerrit account[edit]

  • Create a Wikimedia developer account at if you do not yet have one. Your account's username and password will be the same for Gerrit.
  • Log into the web interface for Gerrit.
  • Click on your username in the top right corner, then choose "Settings".
  • Click "SSH Public Keys" in the menu on the left.
  • Paste your SSH Public Key into the corresponding field and click "Add".

Alternately, once logged in, use these direct links to add your public key to Gerrit and wikitech.

Add SSH key to use with Git[edit]

Start Git Bash.

  • Get ssh-agent running using
eval `ssh-agent`
Be sure to use the accent " ` " located under the tilde " ~ " (or above tab for UK keyboards), not the single quote " ' ".
  • Add your private key to the agent (use path to your private key file)[1]
ssh-add .ssh/id_rsa
if the key is in the default location, use ssh-add ~/.ssh/id_rsa
Key should be in OpenSSH format (.ppk keys can be exported to this format in PuTTyGen).
NOTE: Make sure to double check the <USERNAME> from your Gerrit settings. If this persist, see Gerrit/Troubleshooting to further check what could be wrong.
ssh -p 29418 <USERNAME>
It should give a Gerrit welcome message and then abort. If it doesn't, add the -v (verbose) option to the command to help debug. An example Gerrit SSH connection success message would look like:
Tournesol.png Example:

Download code using Git[edit]

Let's practice downloading the Examples extension. Run the following on the Git Bash command line:

git clone ssh://<USERNAME>

(Substitute <USERNAME> by your Gerrit username. And make sure the URL begins with ssh: and not https:).

This will copy the entire history and the code base of the "Examples" extension repository onto your machine. You will have a working directory of the extension's main branch. If you enter the new directory, you can look at the code and start editing it.

By default, Git will create a directory that has the same name as the project in the URL you give it - basically whatever is after the last slash of the URL. If you want something different, you can just put it at the end of the command, after the URL.

Obviously, just cloning the Examples extension will not give you a development environment setup or a running MediaWiki installation. (Running will require MediaWiki Core and placing the code you checked out in a location expected by your web server.)

You can download MediaWiki Core using Git, as well as the source code of any project repository hosted at (the Wikimedia Foundation server cluster).

For example, to clone the mediawiki-core repository or the repository of an extension which you are interested in:

git clone ssh://<USERNAME>
git clone ssh://<USERNAME><EXTENSION>.git

(Substitute <USERNAME> by your Gerrit username and <EXTENSION> by the extension name.)

You can also copy this git command from the top of the project's home page in Gerrit.

Even after executing these commands, you may experience later errors in installing the Vagrant virtual machine, for which these instructions must be followed to download the additional MediaWiki dependencies using composer, a PHP package management system, for MediaWiki versions ≥ 1.25.

Prepare to work with Gerrit[edit]

Your commit message needs a "change ID" in order to work with Gerrit. You can see these in the git log for a project and if you browse changes on Gerrit, they look like Change-Id: Ibd3be19ed1a23c8638144b4a1d32f544ca1b5f97 starting with an I (capital i)). Each time you amend a commit in response to Gerrit feedback git gives it a new commit ID, but because this change ID stays the same Gerrit will keep track of it as a new "patch set" addressing the same change.

There's a git add-on called git-review that adds a Change-ID line to your commits and manages other aspects of using Gerrit. Using git-review is recommended as makes it easier to configure your Git clone, to submit a change or to fetch an existing one.

Installing git-review[edit]

For more details, please see Gerrit/git-review#Installation.

Linux & UNIX[edit]

Using the graphical software package management tool of your Linux distribution to install git-review is recommended.

If git-review has not been packaged by your distribution, check Gerrit/git-review#Linux for other options such as installing git-review by using the pip Python package installer.

On FreeBSD, install git-review through ports.


In Windows, please see Gerrit/git-review#Windows.

OS X[edit]

For OS X 10.11 El Capitan and later, follow Gerrit/git-review#Method 2.

On versions of OS X prior to 10.11, use the pip Python package installer by following Gerrit/git-review#Method 1.

Configuring git-review[edit]

Git is a distributed version control system; it's possible to fetch code from one host, push your changes to another, and submit them to a third for Gerrit code review. It's a lot simpler to work with one "remote" for all three. Since Git's default remote name is "origin" and most guides on the web use that name, let's tell git-review to use this as well. Replace myusername with the name next to 'Username' at .

git config --global gitreview.remote origin
git config --global gitreview.username myusername

Note: Older versions of git-review used a separate config file:.config/git-review/git-review.conf (in Windows, the file is %USERPROFILE%\.config\git-review\git-review.conf) and add these two lines:

## Deprecated!
defaultremote = origin

Setting up git-review[edit]

After cloning a repository, you need to set it up for git-review. This will automatically happen the first time you try to submit a commit, but it's generally better to do it right after cloning. Make sure that you are in the directory of the project that you cloned (otherwise you will get an error "fatal: Not a git repository"). Then enter

git review -s --verbose

Towards the end of the output, you should see something like this:

Found origin Push URL: ssh://
Fetching commit hook from: scp://
2019-02-19 12:40:16.712892 Running: scp -P29418 .git/hooks/commit-msg

If you see "the authenticity of host can't be established..." Don’t worry, this is supposed to happen the first time. Type "yes".

This may ask you for your git username, if it's different from the shell username you're using.

How to submit a patch[edit]

For a brief overview see Gerrit/Tutorial/tl;dr.

The main avenue for submitting changes to MediaWiki code is to first join the MediaWiki development community so you can submit changes to Gerrit, our code review tool.

Make sure that you cloned the code repository that you are interested in (see #Download code using Git) and that you are in that directory.

Note Note: You will have to probably clone mediawiki-core to your development server's DocumentRoot directory, which is set to /var/www/html/ in most Apache web server installations. This can vary according to your web server software and version. Cloning directly to your DocumentRoot might not be permitted if you are a non-privileged user. You can create a directory inside your DocumentRoot and make it writeable by using the chmod command in Linux. Badly configured permissions can expose your development server to potential security risks.

Update master[edit]

Make sure that your master branch (the branch created when you initially cloned the repository) is up to date:

git pull origin master
Tournesol.png Example:

However, note that a few repositories use different terms (for example operations/puppet has a "production" instead of a "master" branch).

Create a branch[edit]

First, create a local branch for your new change. Give the branch a short but reasonably descriptive name (e.g. T1234, bug/1234, cleanup/some-thing, or badtitle-error). Keep in mind that other people will also use this name to identify your branch when they're reviewing your patch.

git checkout -b BRANCHNAME origin/master
Tournesol.png Example:

This will create a new branch (BRANCHNAME) from the latest 'master' and check it out for you. This is equivalent to doing

git branch BRANCHNAME --track origin/master
git checkout BRANCHNAME

Make and commit your change[edit]

Usual way[edit]

"git diff" - Git Foundations

Modify your local code in some fashion. Using your preferred editor, modify the file Example/Example.body.php

Then check the changes you've made, within the file(s) and within the directory:

git diff

Git diff.png

Without any extra arguments, a simple git diff will display in unified diff format (a patch) what code or content you've changed in your project since the last commit that are not yet staged for the next commit snapshot.

Then check the changes you've made, within the file(s) and within the directory:

git status

Git status.png

You run git status to see if anything has been modified and/or staged since your last commit so you can decide if you want to commit a new snapshot and what will be recorded in it.

This will show all modified files. To prepare submitting a file, you should add your changes to the index (the staging area between your working copy and your local repository), which is done by using the git add command.

git add Example/Example.body.php

Git status 2.png

You pass a file to git add when you want the changes you made to it to be included in your next commit.

Any files you've changed that are not staged by you doing git add will be left alone - this means you can craft your commits with a bit more precision.

At any time you can always review the changes already added to the staging area by running git status, and look at the diff with git diff --cached:

Git diff --cached.png

The git diff --cached command will show you what contents have been staged. That is, this will show you the changes that will currently go into the next commit snapshot.

Once you are happy with the change list, you can add them to your local repository by using

git commit
Tournesol.png ExampleExtension/.git/COMMIT_EDITMSG:

You will then be asked in an editor to add a descriptive message for this commit message. You must follow the Commit message guidelines. This is what other people will see when you will later push that commit to another repository.

Note Note: Normally, you do not manually add a Change-Id and it will be added in automatically once you exit the commit screen. Please see that you give the bug id correctly with the single spacing in between Bug: <id_here> as given in the above example.

Tournesol.png Example:

You can repeat this step over and over until you have a set of changes that you want to have pushed to the master branch. One of the cool things about git is that when you git commit, you are committing to your local copy. This means you can commit as often as you like without potentially screwing things up for another developer on the project, unlike in SVN where you would want to be very careful that the changes you commit would not cause things to break.

Hence the workflow is something like:

 # Add change:
 git add <some file>
 # Verify list of files added to the staging area
 git status
 # Review diff of changes staged:
 git diff --cached
 # repeat until you are happy with your changes
 git commit
 <edit commit message>
 git show
 # check what would be pushed to Gerrit

Ensure that your commit message follow the guidelines mentioned at Gerrit/Commit message guidelines.

Prepare to push your change set to Gerrit[edit]

Before your changes can be merged into master, they must undergo review in Gerrit.

But first, it's a good idea to synchronize your change set with any changes that may have occurred in master while you've been working ("rebasing"). From within the branch you've been working on, execute the following command:

git pull --rebase origin master
Tournesol.png Example:

This command will fetch new commits from the remote and then rebase your local commits on top of them. It will temporarily set aside the changes you've made in your branch, apply all of the changes that have happened in master to your working branch, then merge (recommit) all of the changes you've made back into the branch. Doing this will help avoid future merge conflicts. Plus, it gives you an opportunity to test your changes against the latest code in master.

Once you are satisfied with your change set and you've rebased against master, you are ready to push your code to Gerrit for review. If you made several related commits, consider merging them into one single commit for review.

Push your change set to Gerrit[edit]

It is recommended to use git-review to submit patches for review. If you do not have installed git-review and do not want to do so, you can use the Gerrit patch uploader to submit your patch.

If you installed git-review and you ran git review -s to set it up for this repository, the command to push changes to Gerrit is:

git review -R

The -R option tells git-review not to perform a rebase before submitting the change to Gerrit.

Tournesol.png Example:

Upon success, you'll get a confirmation and a link to the changeset in Gerrit.

New patchset: preilly; "Added get version method to extension" [test/mediawiki/extensions/examples] (master) -

View the Change / Next Steps[edit]

As of 2018, Gerrit has a new web interface called PolyGerrit. You can use the new web interface via and the old interface via

A freshly uploaded sample changeset in Gerrit's new PolyGerrit web interface
A freshly uploaded sample changeset in Gerrit's old deprecated web interface

If you want to see your changed files in their context then click on the (gitiles) link (you then will see).

If your commit addresses a ticket in Phabricator, a comment will be automatically added in the Phabricator task if you followed the Commit message guidelines. If you did not, you could manually add a comment on that Phabricator ticket by linking to its changeset in Gerrit.

Note that Gerrit's diff algorithm (jGit) is slightly different from git's default diff algorithm. Hence the differences displayed by Gerrit might not look like the differences displayed by Git on your machine.

Other common situations[edit]

Also see Gerrit/Advanced usage if your situation is not covered here.

Squash several commits into one single commit via rebase[edit]

If you made several related commits to your local repository prior to wanting to submit for review, you should squash (merge) those commits into one single commit.

The --interactive or -i option allows you to change (rewrite) your commit history. For each commit, you can modify and change the commit message, add or remove files, or perform other modifications.

First you need to tell git how far back you want to pull. To get a list of all changes in your branch:

git rebase -i origin/master

You can also limit the displayed list of recent changes. HEAD~3 means pull the last three commits:

git rebase -i HEAD~3

After you type this command, your text editor will display your commits in reverse order and a list of available commands:

Tournesol.png Example:

Since we only want to send one commit to review, we will squash the last two commits into the first. Hence change all but the first "pick" to "squash":

pick aa8cf1d Adding method customFilterFunctionGetRiskyCountryCodeScore() to GatewayAdapter.
squash 38828e2 Adding $wgDonationInterfaceCustomFiltersFunctionsRiskyCountries to donationinterface.php
squash be33007 Fix a typo

When you finished picking and squashing and saved the file, another file will open in your text editor to allow you get to edit and merge your commit messages. Be careful to only keep one of the Change-Id lines and have it be at bottom of the message after one empty line.

Your messages from your previous commits will automatically be placed in this message:

Tournesol.png Example:

Remember to put your (updated) summary message in the commit. In this case the new summary message will be:

(mingle-fr-2012-69) Adding a custom filter for risky countries.

Note Note: In regards to which Change-Id you want to use, squashing a commit into an existing commit (one that's already in Gerrit), you need to pick the Change-Id that belongs to the one you meant to submit a new patchset for (the surviving commit). If your commits are new and are not in Gerrit, it does not matter which Change-Id you choose.

If all goes well, you should see a successful rebase message:

Tournesol.png Example:

Afterwards, submit your patch for review:

git review

You should see a message like this showing your git review went to Gerrit (in this example, to ):

Tournesol.png Example:

Amending a change (your own or someone else's)[edit]

BEWARE: git review -d performs a hard reset that destroys all local changes. Stash or commit changes you wish to preserve first.

Sometimes, you might need to amend a submitted change. You can amend your own changes as well as changes submitted by someone else, as long as the change hasn't been merged yet.

Rebase to bring your local branch up to date with the remote. It's best to make rebase updates a separate patch, so that your code reviewers have an easy time seeing what changes you've made. Assuming you are using Gerrit, you can do this by clicking the "Rebase Change" button when viewing your patch in Gerrit's web interface.

If you have git-review, hard reset and checkout the change with this command:

git review -d <change number>

Note, if you already have the change in a branch on your local repository, you can just check it out instead:

git checkout <branch name>

For example:

git review -d 9332
Tournesol.png Example:

Or, if you already have the branch,

git checkout review/preilly/2012/bug12345

Should accomplish the same thing.

Making changes in the "vim" text editor

Next, make some changes.

vim Example/Example.body.php

git add the files as needed, then commit the change (ensuring you are amending the commit):

git add Example/Example.body.php
git commit --amend --all

Vim git commit amend.png

Tournesol.png Example:

NOTE: DO NOT use the -m flag to specify a commit summary: that will override the previous summary and regenerate the Change-Id. Instead, use your text editor to change the commit summary (in the file .git/COMMIT_EDITMSG if needed, and keep the Change-Id line intact.

Push the change

git review -R
The -R is important here. It tells git-review to not rebase your change against master, which clutters diffs between patch set 1 and 2.
Tournesol.png Example:

New patchset: preilly; "Added get version method to extension" [test/mediawiki/extensions/examples] (master) -

Push to a branch different than master[edit]

In the screenshots above, the commit was pushed to the master branch. The branch name only appeared as the topic of the commit in the Gerrit UI. If you really want to push to a different branch than master, you have to push via git review <branch name>.

Editing via the web-interface[edit]

If you're logged in to Gerrit, you can also edit within the web-interface. This can be useful for making small patches, or for non-developers to contribute small fixes.

  1. Go to (e.g. )
    • (perhaps via the mw:Extension:Foo page, using the "code review" link in the infobox, and then the click the project name in the list of past patches, and then "General" in the toolbar.
  2. Click "Create Change"
  3. Set branch to "master" (if you don't want to use master branch you can use the other branches available for that project)
  4. Set the topic to something of your choosing (e.g. "copy-edit" - must be all-one-string) (optional)
  5. Write a description ("commit summary") in the big text field, with:
    1. a one-line summary (This will be the commit title. It should be self-explanatory giving full context for the change, like a good edit-summary. It should Not end with a fullstop.)
    2. a blank line
    3. a more detailed paragraph (optional, if desired)
    4. "Bug: Txxxx" (Must be a capital "B" and with space after the colon)
  6. Click "Create"
  7. Under "Files", click the "Edit" button
  8. Under "Files", click "Add"
  9. Type the folder/file path for the file you wish to edit (e.g. i18n/en.json) and click "Open"
  10. Find the line(s) you want to change, and change them.
  11. Click "Save"
  12. Click "Close"
  13. Click "Publish edit"
  14. Click the button "Start Review"


For steps 1-6 there is also an alternative way:

  1. Go to,dashboards/default (e.g.,dashboards/default )
  2. Click the topmost patch under "Merged Changes" of the chosen branch (e.g. master)
  3. Click "Follow-Up"
  4. Write a description ("commit summary") in the big text field similarly as in the step 5 above
  5. Click "Follow-Up"
  6. Change the topic to something of your choosing (e.g. "copy-edit" - must be all-one-string) (optional)

If you need to change the commit summary, you can use these steps:

  1. Under "File Path", click "Commit Message"
  2. On top of the right panel, click the "Edit" button
  3. Make changes to the commit summary.
  4. Click "Save"
  5. Click "Close"
  6. Click "Publish edit"

How code is reviewed in Gerrit[edit]

Code review is an essential part of our contribution workflow. The principle is basic: any patch must be reviewed by others before being merged.

This means that your code will need reviewers. Check our advice for getting reviews.

Review before merge[edit]

It's important to us to have a review-before-merge workflow for MediaWiki core and also for any extension we deploy. We will also offer that option to any extension author who wants it for their extension. The one exception is localisation and internationalisation commits, which will be able to be pushed without review.

Who can review? Gerrit project owners[edit]

After creating a Gerrit account, anyone can comment on commits and signal their criticisms and approvals. Anyone can give a nonbinding "+1" to any commit. However, for any given repository ("Gerrit project"), only a small group of people will have the ability to approve code within Gerrit and merge it into the repository. This superapproval is a "+2" even though that's a misleading name, because two +1 approvals DO NOT add up to a +2. These people are "Gerrit project owners". Learn about becoming a Gerrit project owner.

Even within a Gerrit project, we can also specify particular branches that only specific people can pull into.

How to comment on, review, and merge code in Gerrit[edit]

A freshly uploaded sample changeset in Gerrit's new PolyGerrit web interface
Side-by-side diff in Gerrit's new PolyGerrit web interface
A freshly uploaded sample changeset in Gerrit's old deprecated web interface
Side-by-side diff in Gerrit's old deprecated web interface

Anyone can comment on code in Gerrit.

Viewing and commenting on code[edit]

  • Make sure you have a login (Get an account!). If you don't know, try logging in at; the username and password should be the same. If you can't, ask in #mediawiki connect for someone to help.
  • Log in to Gerrit. If you know the changeset you want to look at (URL will look like ), go to that. Otherwise, use the search box and try searching. You can search by author ("Owner"), Gerrit project, branch, changesets you've starred, etc. The Gerrit search documentation covers all of the different search operators you can use.
  • The changeset has a few important fields, links and buttons:
    • Assignee. An optional field to make a single person responsible for handling reviewing the changeset. This should only be set if the assignee has agreed.
    • Reviewers. 'jenkins-bot' is the autoreviewer that auto-verifies anything that passes the Jenkins tests. It will report a red or green mark depending on whether the build passes.
    • The Add" button on the right of Reviewers:. Manually pings someone to request their review. It'll show up in their Gerrit dashboard.
    • Files: Open All. Opens the diff (each file in a separate browser tab). You can double-click on a line and then press C to comment on that line, then save a draft comment! Then, click the green "Up to change" arrow to go back to the changeset, and click "Reply…" to publish your comment.
    • Reply… ("Add comment"). Publish your thoughts on the commit, including an overall comment and/or inline comments you added (see above).
      • If, upon code review, you approve, use "+1" under "Reply…"; otherwise, use "-1" to disapprove. These numbers are nonbinding, won't cause merges or rejections, and have no formal effect on the code review.
    • Abandon (you'll see this if you wrote this diff). This action removes the diff from the merge queue, but leaves it in Gerrit for archival purposes.

Comparing patch sets[edit]

Every time you amend your commit and submit it for review, a new patch set is created. You can compare the different patch sets like this:

  • Under Files, select either Open All or choose a specific file listed to open that file.
  • On the left side under Patch Set, Base is preselected. On the right of the screen under Patch Set, the latest patch set is preselected. Adjust the selected patch sets to your needs.

Formally reviewing and merging or rejecting code[edit]

If you are one of the Gerrit project owners, you'll also see:

  • Abandon button
  • under Reply, additional Code-Review options to +2 (approve) or -2 (veto) a diff, and a Post button (publish your comment and merge diff into the branch, in 1 step)
  • Submit button (merge -- only useful if you or someone else has already given a +2 approval to the diff, but not merged it)

And once you've merged something into the example Gerrit project you'll see it in .

If you merged a commit that references a ticket in Phabricator, please go to that task and change its status to "Resolved" (and reference the merge ID if gerritbot has not already posted it).


For problems and how to solve them, see Gerrit/Troubleshooting.

See also[edit]

Also useful are these pages:

Third party guides to Git[edit]

Historical documents[edit]

  • If as a Ubuntu user you have a "Permission denied (publickey)" message, please check on this help page