As I was reading git: push a single commit and thinking about pushing commits in small batches, I started wondering if I could specify the local revision relative to the number of commits I want to push at once.
For example, let's say I have 12 outstanding commits to push. I can use HEAD~9
to push the first 3 outstanding commits; to push the next 3, I have to use HEAD~6
and so on. But I'd like to be able to use my shell's history without having to edit it for each batch.
$ git log --oneline myremote/mybranch..mybranch
0a594a4 Blah blah 12
9a4b42e Blah blah 11
d81227e Blah blah 10
803f1d3 Blah blah 9
aa7dcbc Blah blah 8
fc410e6 Blah blah 7
d57198e Blah blah 6
75f8ed6 Blah blah 5
4e801b4 Blah blah 4
7333461 Blah blah 3
3bc453e Blah blah 2
562690f Blah blah 1
Obviously I can push 1-3 with git push myremote 7333461:mybranch
, I can also use HEAD~9:mybranch
, but is there any way to say something like myremote/mybranch+3
, to get the same hash? Everything I've tried with rev-parse
takes me backwards, relative either to HEAD or myremote/mybranch (when it works at all).