Project

General

Profile

Gerrit » History » Revision 2

Revision 1 (stbuehler, 2015-01-06 13:48) → Revision 2/3 (stbuehler, 2015-01-06 13:48)

h1. Gerrit 

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

 h2. Checkout 

 Either checkout a new tree: 

     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 ssh://<gerritusername>@gerrit.lighttpd.net:29418/lighttpd/lighttpd2.git 

 Also you want the "commit-msg hook":https://gerrit.lighttpd.net/Documentation/cmd-hook-commit-msg.html, you can get it with (in the checkout directory): 

     scp -p -P 29418 <gerritusername>@gerrit.lighttpd.net:hooks/commit-msg .git/hooks/ 
     chmod +x .git/hooks/commit-msg 

 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 --ad remote.gerrit.fetch '+refs/changes/*:refs/remotes/gerrit/changes/*' 

 h2. 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":http://git-scm.com/docs/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 

 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.)