Gerrit/Getting started
From MediaWiki.org
< Gerrit
This is a very short guide to using Git and Gerrit for MediaWiki development. For a more thorough guide, see Gerrit/Tutorial.
First steps:
- Install and configure Git; Create an SSH key (steps 1-3, the rest is for GitHub instead of Gerrit); Create a developer account
- Log in and add your public key to gerrit and to wikitech.
- Install git-review
Get the code:
- core:
git clone ssh://<username>@gerrit.wikimedia.org:29418/mediawiki/core.git - extension:
git clone ssh://<username>@gerrit.wikimedia.org:29418/mediawiki/extensions/<extension>.git - skin:
git clone ssh://<username>@gerrit.wikimedia.org:29418/mediawiki/skins/<skin-name>.git
Write and send new code:
git checkout mastergit pullgit checkout -b <meaningful-branch-name> # Branch naming tips are available.# Now write some code. See the Git commands "add", "rm" and "mv" to add, remove or rename files. When the code is tested and you're ready:git commit --all # In the Gerrit world you should do this only once per branch! Remember to follow the commit message guidelines.git show HEAD # Make sure that you are sending what you wanted to send. Press "q" to quit.git remote update; git review # This makes sure git-review is aware of recent changes on Gerrit and sends your code.
In Gerrit, click your change and write a reviewer name in the input box near the "Add Reviewer" button. If you don't know who to invite, try the maintainer for the component you've edited, or ask on IRC (#wikimedia-devconnect).
If the reviewer asks you to make a change, make it and amend your commit:
git review --download <change ID> # e.g. 1234 in gerrit.wikimedia.org/r/1234# Make the needed changes to the source files.git commit --all --amend # You can do this more than once. You can change the commit message, but make sure to leave the "Change-Id" line intact.git remote update; git review # This creates a new patch set in the same Gerrit change, and sends an invitation to review the code again.
To review other people's code, just follow the same steps to amend a change described above, using the corresponding <change ID>.

