Not sure if you can pull individual commits out of a range abcdef..123456
. Git range syntax is explained in the docs for gitrevisions, and it doesn't look like it works that way. Still, there's another way to get what you want using only the range hashes and the ones to exclude.
Assuming the two hashes in range fromgerritSHA1..togerritSHA1
that you don't want are skiphash1
and skiphash2
, try:
$ git rev-list --reverse fromgerritSHA1..togerritSHA1 | grep -vE 'skiphash1|skiphash2' | git cherry-pick --stdin
git rev-list --reverse fromgerritSHA1..togerritSHA1
prints out commit hashes in range fromgerritSHA1..togerritSHA1
, one line at a time. --reverse
is needed to list the hashes in the correct order for the cherry-pick.
grep -vE 'skiphash1|skiphash2'
removes the two hashes you don't want from the list. You can add more hashes to skip, just separate them with |
.
Finally, the list of only the commit hashes you want is passed to git cherry-pick --stdin
.