cherry-pick command allows you to specify a range of commits to be cherry-picked onto the current branch.
This can be done with the
A123..B234 style syntax – where
A123 is the oldest commit in the range.
Consider a scenario with the following chain of commits on
commit A123 Author: Troy McCall <email@example.com> Date: Thu Aug 9 11:36:54 2018 -0400 - update CARoot commit B234 Author: Troy McCall <firstname.lastname@example.org> Date: Wed Jul 25 15:20:10 2018 -0400 - Allow wildcards and block heading and trailing dots commit C345 [....] commit D456 [....] commit E567 Author: Troy McCall <email@example.com> Date: Thu Jul 19 14:39:25 2018 -0400 - Document Go 1.10 requirement commit F789 [....]
But you only need commits
D456 , what do ya do?
#take these steps:
- Open a terminal window in your
$ git logor open the
my-feature-branchcommit history on your remote (github) - you’ll need this for reference
- in another terminal window,
$ git checkout master
- branch off of master
$ git checkout -b cherry-pick-my-feature-branch
- now here’s the tricky part, if you try to run
$ git cherry-pick B234..D456
This will cherry-pick commits
HEAD and skip over
This is because the lower-bound is exclusive.
If you want to include
$ git cherry-pick B234^..D456
now push up that bad boy to origin
$ git push -u origin cherry-pick-my-feature-branch
man git-cherry-pick for more details.