What to do on each repo to use Gerrit with it…
git config --local remote.origin.push HEAD:refs/for/master curl -Lo .git/hooks/commit-msg http://review.example.com/tools/hooks/commit-msg git remote add ssh://<username>@gerrit-ring.savoirfairelinux.com:29420/ring-daemon git config --local push.draft.url :refs/drafts/master git config --local --add 'remote.origin.fetch +refs/changes/*:refs/remotes/origin/changes/*'
You must review every commit made before merging.
Anyone can make a pull request. Sign in with OAUTH, add an SSH key, and push there.
Created for Android. Still used? https://android-review.googlesource.com/
Docs explain well how this (shitty >:-)) software works:
Pull requests are made by pushing to a magic branch name:
git push origin HEAD:refs/for/master
This is a win point over GitHub, whose pull requests duplicate info that should be in the commit message.
You then want:
git config --local remote.origin.push HEAD:refs/for/master
to be able to do:
GitHub branch “force pushes” are detected by a magic commit message line which says which commit was replaced.
Yes, it makes our commits dirty.
You can do that automatically with:
curl -Lo .git/hooks/commit-msg http://review.example.com/tools/hooks/commit-msg
from inside the repo followed by:
git commit --amend git push origin HEAD:refs/for/master
Reviewers fetch / checkout locally with:
git fetch http://gerrithost:8080/p/RecipeBook refs/changes/68/2368/2 git checkout -b FETCH_HEAD
68is the modulo 100 of the ID
2368is the ID, shown in the URL path as
2is the patch number (how many times it was force pushed - 1)
You can get a good command from the “Download” dropdown at the top right corner.
Note that since the remote ref is stored under a non-standard
refs/changes, it does not create a branch
To fetch all changes on
git config --local --add 'remote.origin.fetch +refs/changes/*:refs/remotes/origin/changes/*'
/#/c/2538/6means patchset 6 of change
/#/c/2538means the latest patch.
I think when you rebase and force push multiple commits, it updates the patch-set per commit
git clone https://gerrit.googlesource.com/gerrit
Official GitHub mirror: https://github.com/gerrit-review/gerrit
Official deployment seems to be through a
war file download (standard, portable and annoying Java Server Pages deployment).
Non-official from gerritforge https://www.linkedin.com/company/gerritforge-llp, a Gerrit service company:
echo 'deb mirror://mirrorlist.gerritforge.com/deb gerrit contrib' | sudo tee /etc/apt/sources.list.d/gerritforge.list sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1871F775 sudo apt-get update sudo /etc/init.d/gerrit start firefox http://localhost:8080
Currently running 2.12.
You can create and switch to infinitely many accounts, including admin, without password, from the top left corner
All diffs on the same page
On 2.12, when you hit
Open All, it opens one diff file per new tab page… https://code.google.com/p/gerrit/issues/detail?id=938
Shows all non-merged ancestors and descendants of the change. Very confusing, since they should be seen as a tree, but they are shown linearly instead.
TODO: this looks like Gerrit specific extra metadata that can be used to tag commits.
This was force pushed, either updated or removed.
Gerrit knows that something was updated on a force push because of the
Change-Id on the commit message.
To get the most recent one, change e.g.
Patch Sets (1/4) to the latest
Patch Sets (4/4).
You can edit changes in the browser! Amazing for a system that has no web-view.
To back up changes that are not yet ready… use:
git push origin HEAD:refs/drafts/master
git remote add draft ssh://<username>@gerrit-ring.savoirfairelinux.com:29420/ring-daemon git config --local push.draft.url :refs/drafts/master git push draft
The only thing this does is to hide the draft from everyone else. You can then explicitly allow individual people to see the draft.
Publish review line comments
Even that is hard.