This is a very short (tl;dr) how-to guide to using Git and Gerrit for MediaWiki development. For a tutorial which includes explanations, see Gerrit/Tutorial.
For MediaWiki core:
git clone ssh://<username>@gerrit.wikimedia.org:29418/mediawiki/core.git mediawiki
Or, for an extension:
git clone ssh://<username>@gerrit.wikimedia.org:29418/mediawiki/extensions/<extension>.git
Or, for a skin:
git clone ssh://<username>@gerrit.wikimedia.org:29418/mediawiki/skins/<skin-name>.git
Write and send new code:
git review -s # This sets up git review on the new cloned repository.
git checkout master
# 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 want to send. Press "q" to quit.
git review -R # This sends your code to Gerrit.
, click your change to open it. Under "Reviewers", click the "Add Reviewer" button. Write a reviewer name in the input box. If you don't know who to invite for reviewing, try the maintainer
for the component you've edited, or ask on IRC
If the reviewer asks you to make a change, make it and amend your commit:
# Make the needed changes to the source files. See the Git commands "add", "rm" and "mv" to add, remove or rename 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 review -R # This creates a new patch set in the same Gerrit change, and sends an invitation to review the code again.
Last edited on 7 September 2021, at 11:10
Content is available under CC BY-SA 3.0
unless otherwise noted.