Project

General

Profile

Actions

Gerrit

First you have to register a user account at https://gerrit.lighttpd.net (requires an openid) and add your ssh public key.

Checkout

Configure gerrit.lighttpd.net in your ~/.ssh/config:

Host gerrit.lighttpd.net
HostName gerrit.lighttpd.net
Port 29418
User <gerritusername>

Either checkout a new tree:

git clone -o gerrit gerrit.lighttpd.net:lighttpd/lighttpd2.git

(If you didn't configure .ssh/config use git clone -o gerrit ssh://<gerritusername>@gerrit.lighttpd.net:29418/lighttpd/lighttpd2.git)

or add the remote to your existing checkout:

git remote add gerrit gerrit.lighttpd.net:lighttpd/lighttpd2.git

Also you want the commit-msg hook, you can get it with (in the checkout directory):

scp gerrit.lighttpd.net:hooks/commit-msg .git/hooks/
chmod +x .git/hooks/commit-msg

(If you didn't configure .ssh/config use this to copy it: scp -p -P 29418 <gerritusername>@gerrit.lighttpd.net:hooks/commit-msg .git/hooks/)

To push changes ("pull requests" in github language) to gerrit you want to push to "refs/for/master" (all work is currently done on the master branch). I like to use the following to always push to this ref:

git config --add remote.gerrit.push HEAD:refs/for/master

If you want to download all changes on git remote update you can add this too:

git config --add remote.gerrit.fetch '+refs/changes/*:refs/remotes/gerrit/changes/*'

Uploading a change ("pull request")

Just create your commits as usual. As the review is done per commit you should make sure each commit compiles and is a fine change on its own. Use git rebase to squash, edit and reorder your commits (git rebase is the most powerful tool for advanced git users).

Then just push it to gerrit refs/for/master, if you configured it like above this should work fine:

git push gerrit

(Or make it explicit: git push gerrit HEAD:refs/for/master)

Depending on the feedback of the review you can then change your commits (git rebase or for single commits git commit --amend) and upload them again. The "commit-msg" hook you installed will have added a Change-Id to each commit which is used to track changes. (If you didn't use the hook, gerrit adds its own id; you need to pull the commit from gerrit in this case to modify it.)

Updated by stbuehler almost 10 years ago · 3 revisions