This is a way to show gerrit commit ordering by gerrit number. This method does not require any extra software, only gerrit access, git, and a bit of shell.

For a set of open gerrits on a single linear stack, you can see the order in the "Related Commits" tab. The newest are listed at the top and the oldest are listed at the bottom. However, the gerrit numbers are not listed in that tab (you need to check each link to see the gerrit number), and the list could include other gerrits depending on the situation.

To see the commit order by gerrit number, you can create a local repo and fetch the changes to your local repo, and then use the git log command with the --decorate option to show the gerrit numbers associated with each commit.

Create a sandbox repo. This should normally be separate from your working repo, since we will be fetching a large number of branches.

$ git clone openafs-gerrits
$ cd openafs-gerrits

Add an additional 'fetch' line to your .git/config to fetch the gerrit 'refs/changes' branches:

$ git config --add remote.origin.fetch "+refs/changes/*:refs/remotes/origin/changes/*"

Your '.git/config' file should look like this now:

$ cat .git/config
[remote "origin"]
    url =
    fetch = +refs/heads/*:refs/remotes/origin/*
    fetch = +refs/changes/*:refs/remotes/origin/changes/*

Run git fetch to fetch all of the gerrit changes.

$ git fetch
(... snip ...)
* [new ref]             refs/changes/99/99/4     -> origin/changes/99/99/4
* [new ref]             refs/changes/99/99/5     -> origin/changes/99/99/5
* [new ref]             refs/changes/99/999/1    -> origin/changes/99/999/1

At this point your local repo has branches for all of the gerrits, even the ones already merged. The format of the branch names is:

origin/changes/{gerrit mod 100}/{gerrit}/{patchset}

Find the top commit of the stack. I normally do this by looking at the "Related Changes" tab in gerrit. The current top commit for 1.8.x is 14946 (Linux-5.17: Kernel build uses -Wcast-function-type). The patchset number is listed under "Patchsets" (top right). The current patchset number is 5, so the branch name is:


List the changes with gerrit numbers of commits not merged onto the release branch. This is done by providing a range of commits, from the current release branch to the top gerrit. We can pipe through nl to add a merge order number.

$ git log  \
    --reverse \
    --oneline \
    --decorate \
    origin/openafs-stable-1_8_x..origin/changes/46/14946/5 \
  | nl

     1  0937ab044d (origin/changes/64/14964/1) Add missing double include guard
     2  0d6ca2205d (origin/changes/65/14965/1) autoconf: Remove/update obsolete autoconf macros
     3  4c319a35b1 (origin/changes/94/14594/4) warn when starting without keys
     (... snip ...)
    45  8148e2d5d7 (origin/changes/45/14945/5) Linux-5.17: kernel func complete_and_exit renamed
    46  dd996b738a (origin/changes/46/14946/5) Linux-5.17: Kernel build uses -Wcast-function-type

Optionally, we can use some shell to clean up the output. This shows the gerrits in the order to be merged without conflicts.

$ git log  \
    --reverse \
    --oneline \
    --decorate \
    origin/openafs-stable-1_8_x..origin/changes/46/14946/5 \
  nl |
  while read i h b s; do g=$(echo $b | cut -f4 -d/); echo $i $g $s; done

1 14964 Add missing double include guard
2 14965 autoconf: Remove/update obsolete autoconf macros
3 14594 warn when starting without keys
(... snip ...)
45 14945 Linux-5.17: kernel func complete_and_exit renamed
46 14946 Linux-5.17: Kernel build uses -Wcast-function-type