1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 23:28:02 +00:00

Add Cherry Pick A Range Of Commits as a git til

This commit is contained in:
jbranchaud
2017-04-11 17:38:56 -05:00
parent 05c3a43733
commit 9096de500f
2 changed files with 23 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
For a steady stream of TILs from a variety of rocketeers, checkout For a steady stream of TILs from a variety of rocketeers, checkout
[til.hashrocket.com](https://til.hashrocket.com/). [til.hashrocket.com](https://til.hashrocket.com/).
_523 TILs and counting..._ _524 TILs and counting..._
--- ---
@@ -140,6 +140,7 @@ _523 TILs and counting..._
- [Checking Commit Ancestry](git/checking-commit-ancestry.md) - [Checking Commit Ancestry](git/checking-commit-ancestry.md)
- [Checkout Old Version Of A File](git/checkout-old-version-of-a-file.md) - [Checkout Old Version Of A File](git/checkout-old-version-of-a-file.md)
- [Checkout Previous Branch](git/checkout-previous-branch.md) - [Checkout Previous Branch](git/checkout-previous-branch.md)
- [Cherry Pick A Range Of Commits](git/cherry-pick-a-range-of-commits.md)
- [Clean Out All Local Branches](git/clean-out-all-local-branches.md) - [Clean Out All Local Branches](git/clean-out-all-local-branches.md)
- [Clean Up Old Remote Tracking References](git/clean-up-old-remote-tracking-references.md) - [Clean Up Old Remote Tracking References](git/clean-up-old-remote-tracking-references.md)
- [Delete All Untracked Files](git/delete-all-untracked-files.md) - [Delete All Untracked Files](git/delete-all-untracked-files.md)

View File

@@ -0,0 +1,21 @@
# 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.