With the move to gerrit 3.x the backend for gerrit was changed from a postgres database on the server to using git notes inside the project repository itself. This means that each repo and each patchset of each change is self-contained and you are able to fetch a copy of the metadata stored in gerrit and access it through git’s command line.
This is tremendously handy if you need to work off-line or would like to review conversations or notes but do not have access to the gerrit web UI.
Changes and Patchsets
In order to use it you need to understand that changes are stored using the "refs/changes/*" refspec for a repository. You also need to know that the last 2 digits of a change number are used as the parent directory for the change.
The "patchset" for each change (every revision) is stored by it's revision number. Finally there is a special patchset called "meta" which contains data from all previous patchsets.
So, if I wanted to pull out patchset 3 from change 4578, I would access this refspec:
If I wanted all patches and conversations about change 97342, I would access:
Let's say I want go perusing changes for the repository at https://git.linaro.org/ci/dockerfiles.git.
First I clone it, then I list all the refs to see what changes are available, then I fetch the one I'm interested, and finally I look at the notes log for "meta".
git clone https://git.linaro.org/ci/dockerfiles.git cd dockerfiles git ls-remote | grep changes | grep meta
Find the change you are interested in. For this example, let’s use 24699: git fetch origin refs/changes/99/24699/meta git log FETCH_HEAD