I have a scenario where I don't want to cherry-pick a specific commit but a range of git commits from remote. I can do force pull with hard option but that will get all the commits including latest changes from remote. Please suggest how can I pick range of commits from remote.
For instance, this is what I am trying:
git checkout -b newbranch 62ecb3 git rebase --onto master 76cada, 56qwqw, 46erer
The thing is if you are cherry picking a range of commits, it will cherry pick the parent commits correctly but then when it hits a normal commit, it fails and says commit is not a merge.
It is possible to cherry pick from another repo using the command line. You will first need to add the other repository as a remote and then fetch the changes. From there, you should be able to see the commit in your repo and cherry pick it.
Let's say the history is A-B-C-D-E-F-G
, and you'd like to cherry-pick C-D-E-F
.
git cherry-pick B..F
or
git cherry-pick C^..F
or
git cherry-pick C D E F
Usegit cherry-pick 76cada 56qwqw 46erer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With