From d697d97027609cb3925b04ff42c9b73bee3b6e97 Mon Sep 17 00:00:00 2001 From: Asocia Date: Fri, 30 Jul 2021 12:27:59 +0300 Subject: [PATCH] TIL: Cherry picking commits from another branch --- git/cherry-picking-commits-from-another-branch.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 git/cherry-picking-commits-from-another-branch.md diff --git a/git/cherry-picking-commits-from-another-branch.md b/git/cherry-picking-commits-from-another-branch.md new file mode 100644 index 0000000..aca10c3 --- /dev/null +++ b/git/cherry-picking-commits-from-another-branch.md @@ -0,0 +1,13 @@ +You have a commit which contains a good code change but it is in another branch? + +``` +# pick the commit +git cherry-pick + +# apply changes introduced by commit but do not commit the changes +git cherry-pick -n +git cherry-pick --no-commit + +# pick all the commits from A to B +git cherry-pick A^..B +```