Jump to content

User:Dan-nl/Git and Gerrit/Developing for an existing gerrit project

From mediawiki.org

These instructions assume you have already followed the steps mentioned in Setup your Development Environment

tl;dr

[edit]
mkdir /local/project/path
cd /local/project/path
git clone -o gerrit ssh://<your-username>@gerrit.wikimedia.org:29418/mediawiki/extensions/<extension-name>.git
cd <gerrit-project>
git review -s
Continue with the Gerrit Workflow instructions.

Local Project Directory

[edit]

Create a local project directory and switch to it.

mkdir /local/project/path
cd /local/project/path

Clone the Repository

[edit]

Find the project on Gerrit

[edit]
  1. Log into your MediaWiki gerrit account
  2. Locate the project on the gerrit projects page
  3. Click on the link to go to the project’s overview page
    e.g. https://gerrit.wikimedia.org/r/#/admin/projects/mediawiki/extensions/UploadWizard

Find the ssh:// clone url

[edit]
  1. Click on the Branches menu at the left
  2. Determine which Branch of the repository you want to work on
  3. Click on the link (gitweb) next to the branch name and revision
    e.g. HEAD master (gitweb)
  4. Click on the summary menu
  5. Make sure you use the ssh:// url to clone the repository; the https:// version will cause a problem with setting up git review.

Clone the repository

[edit]
  1. open a terminal window
  2. navigate to the directory where you want to work on the extension, e.g., cd /local/project/path
  3. clone the repository
    using “-o gerrit” tells git to use the remote nickname, “gerrit” instead of the default “origin”, which is important for git-review. see Incorrect remote for further information.
cd /local/project/path
git clone -o gerrit ssh://<your-username>@gerrit.wikimedia.org:29418/mediawiki/<gerrit-project-name>.git

Prepare to work with Gerrit

[edit]

From within the cloned repository, run the following command. which will set up git to use the git-review hook when pushing new code to the remote gerrit repository.

cd /local/project/path/<gerrit-project>
git review -s

Continue with the Workflow

[edit]

Continue with the Gerrit Workflow instructions.