Git is a free and open source distributed version control system. Distributed means that there is no central copy of the repository. It's used worldwide by big and small open-source projects, like KDE, Linux, Gnome and so on.

What you'll learn

What you need

In order to use Git, you need to install it! In GNU/Linux, it might be installed. Skip the steps that aren't for your current operating system.

Install Git & git-review in GNU/Linux

sudo apt install git git-review

For other Linux distributions, use the proper package manager.

Install Git & git-review in Mac OS X

brew install git git-review

Install Git & git-review in Windows

pip install git-review

When you register changes in a Git repository, they are signed with your name and email address, to know who has made each change. For this purpose, you need to configure Git before use it. Run these two commands, using your name and email address:

git config --global ""
git config --global "example"

A SSH keys is used to establish a secure connection between your computer and Gerrit. You need to create it in order to connect to the Gerrit instance.

Create an SSH key

ls ~/.ssh
ssh-keygen -t rsa -C ""

Add the SSH key to Gerrit in Wikimedia

Test that SSH works fine

Check that you can connect to the gerrit instance of Wikimedia running the following command, replacing username with yours.

ssh -p 29418

It should give a Gerrit welcome message and then abort.

You need to tell git-review your username. To do it, run the following commands using your username in

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

You have installed and configured Git and git-review to use with Gerrit. Now you can submit patches to the repositories. You need a Developer account in order to do this.

Download the repository

git clone "ssh://"
git review -s
git checkout -b BRANCHNAME origin/master

Commit the changes

Now you can work on the task or patch that you plan to do. When you are ready, submit the patch:

git status
git add file1 file2
git commit
Bug: T999999

Push to the repository

git pull --rebase origin master
git review -R

Congratulations! You have sent a patch to Gerrit and hopefully will get reviewed soon!

If you want to learn more about the topics that we've covered in this codelab, take a look to this resources: