I have two branches. Commit a is the head of one, while the other has b, c, d, e and f on top of a. I want to move c, d, e and f to first branch without commit b. Using cherry pick it is easy: checkout first branch cherry-pick one by one c to f and rebase second branch onto first. But is there any way to cherry-pick all c-f in one command?
Here is a visual description of the scenario (thanks JJD):

Cherry-pick multiple Git commits Since Git 1.7. 2, you can cherry-pick a range of commits by using the dot notation. Note that using this command, the commit A will NOT be included into the cherry-pick. For example, back to the “master” branch, let's try to cherry-pick two commits into the feature branch.
In the History tab, right-click the commit you want to cherry-pick and choose Cherry-Pick. Visual Studio doesn't support cherry-picking more than one commit at a time, so you'll need to repeat this step for each commit that you want to cherry-pick.
Git 1.7.2 introduced the ability to cherry pick a range of commits. From the release notes:
git cherry-picklearned to pick a range of commits (e.g.cherry-pick A..Bandcherry-pick --stdin), so didgit revert; these do not support the nicer sequencing controlrebase [-i]has, though.
To cherry-pick all the commits from commit A to commit B (where A is older than B), run:
git cherry-pick A^..B If you want to ignore A itself, run:
git cherry-pick A..B Notes from comments:
A should be older than B, or A should be from another branch.A^^..B as the caret needs to be escaped, or it should be "A^..B" (double quotes).zsh shell, it should be 'A^..B' (single quotes) as the caret is a special character.(Credits to damian, J. B. Rainsberger, sschaef, Neptilo, Pete and TMin in the comments.)
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