Reputation: 3151
I have gerrit link of an unmerged change, would like to fetch the latest Patch set from that change, is it possible ?
for instance, below is my cherry pick command, I don't know the patch set, can I provide LATEST or something in place of <dontKnowPsNo.>
? or any other way?
git fetch ssh://<URL>:#####/path/to/project refs/changes/20/12345/<dontKnowPsNo.> && git cherry-pick FETCH_HEAD
Upvotes: 3
Views: 2094
Reputation: 28160
curl -s 'https://<your gerrit server>/r/changes/<change id>?o=CURRENT_REVISION' | tail -n+2 | jq -r '.revisions[.current_revision].ref'
will return the correct reference. You'll probably have an easier time using git-review though, in which case you can just do git review -x 12345
.
Upvotes: 1
Reputation: 530
I'd love to find a nice way to do this. So far, best workaround I've found is to do a git ls-remote
, grep for the change number, and then sort on the rightmost value after the slash:
From ssh://gerrit:29418/repo
892b11be21fe58b40a6193a8903eee69319aa46c refs/changes/01/42/1
87e35bb74575ff922d55924520a8eb1440e410ba refs/changes/01/42/2
673467f3ad08c6501808fd33d5b27d640bc6f04e refs/changes/01/42/3
Upvotes: 1