2016-12-15 09:59:11 +00:00
|
|
|
# git cherry-pick
|
|
|
|
|
2016-12-15 15:25:23 +00:00
|
|
|
> Apply the changes introduced by existing commits to the current branch.
|
2019-06-07 11:02:10 +01:00
|
|
|
> To apply changes to another branch, first use `git checkout` to switch to the desired branch.
|
2019-06-03 01:06:36 +01:00
|
|
|
> More information: <https://git-scm.com/docs/git-cherry-pick>.
|
2016-12-15 09:59:11 +00:00
|
|
|
|
2016-12-15 15:25:23 +00:00
|
|
|
- Apply a commit to the current branch:
|
2016-12-15 09:59:11 +00:00
|
|
|
|
2016-12-15 15:25:23 +00:00
|
|
|
`git cherry-pick {{commit}}`
|
|
|
|
|
|
|
|
- Apply a range of commits to the current branch (see also `git rebase --onto`):
|
|
|
|
|
|
|
|
`git cherry-pick {{start_commit}}~..{{end_commit}}`
|
|
|
|
|
|
|
|
- Apply multiple (non-sequential) commits to the current branch:
|
|
|
|
|
2024-01-31 03:55:19 +00:00
|
|
|
`git cherry-pick {{commit1 commit2 ...}}`
|
2019-06-07 11:02:10 +01:00
|
|
|
|
|
|
|
- Add the changes of a commit to the working directory, without creating a commit:
|
|
|
|
|
2023-06-25 13:36:35 +01:00
|
|
|
`git cherry-pick --no-commit {{commit}}`
|