User:Dan-nl/Git and Gerrit/Developing for an existing gerrit project
Appearance
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]- Log into your MediaWiki gerrit account
- Locate the project on the gerrit projects page
- 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]- Click on the Branches menu at the left
- Determine which Branch of the repository you want to work on
- Click on the link (gitweb) next to the branch name and revision
e.g. HEAD master (gitweb) - Click on the summary menu
- Make sure you use the
ssh://
url to clone the repository; thehttps://
version will cause a problem with setting up git review.
Clone the repository
[edit]- open a terminal window
- navigate to the directory where you want to work on the extension, e.g.,
cd /local/project/path
- clone the repository
using â-o gerritâ tells git to use the remote nickname, âgerritâ instead of the default âoriginâ, which is important forgit-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.