In one of the previous Git posts I wrote about cherry picking commits in Git. Today we are going to see how we could do the same but instead of cherry-picking a single commit, we are going to pick multiple, a range of per se.
Prerequisites
- Git
Solution
Cherry-pick commits from an older (A) to a recent commit (B).
git cherry-pick A^..Z
To ignore A
remove the ^
.
If you want to cherry-pick “random” commits, run:
git cherry-pick A C G T Z
Note(s): Cherry-picking it’s not equivalent to rebasing. That will be topic for another time.
Conclusion
To find more neat Git commands and hacks, simply browse the Git category. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.