1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 15:18:01 +00:00
Files
til/git/cherry-pick-a-range-of-commits.md
2017-04-11 17:38:56 -05:00

22 lines
590 B
Markdown

# Cherry Pick A Range Of Commits
Git's `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 `A..B`
style syntax -- where `A` is the older end of the range.
Consider a scenario with the following chain of commits: `A - B - C - D`.
```bash
$ git cherry-pick B..D
```
This will cherry pick commits `C` and `D` onto `HEAD`. This is because the
lower-bound is exclusive. If you'd like to include `B` as well. Try the
following:
```bash
$ git cherry-pick B^..D
```
See `man git-cherry-pick` for more details.