From 09872076b1c666023a9e9e1f6dad52856f1fdc6b Mon Sep 17 00:00:00 2001 From: Chalarangelo Date: Thu, 8 Apr 2021 16:42:37 +0300 Subject: [PATCH] Add cherry-pick --- snippets/pick-commits.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 snippets/pick-commits.md diff --git a/snippets/pick-commits.md b/snippets/pick-commits.md new file mode 100644 index 000000000..c1cb8fb54 --- /dev/null +++ b/snippets/pick-commits.md @@ -0,0 +1,24 @@ +--- +title: Pick changes from one or more commits +tags: commit,branch,intermediate +--- + +Applies the changes introduced by one or more commits. + +- Use `git cherry-pick ` to pick changes from a single commit. +- Use `git cherry-pick ...` to pick changes from all space-separated commits. +- Use `git cherry-pick ..` to pick changes from a range of commits. + +```sh +git cherry-pick (... | ..) +``` + +```sh +git cherry-pick 3050fc0de # Picks changes from the commit `3050fc0de` + +git cherry-pick 3050fc0de c191f90c7 +# Picks changes from the commits `3050fc0de`, `c191f90c7` and `0b552a6d4` + +git cherry-pick 3050fc0de..c191f90c7 +# Picks changes from the commits in the range `3050fc0de` - `c191f90c7` +```