by BehindJava
What is Git cherry pick
In this tutorial, we are going to learn about Git cherry pick in detail.
Git cherry pick
This is used to selectively pick only a few commits and bring them to the master branch.
-
Create a commit on master.
touch f1 git add . git commit -m "a"
-
Create a test branch and create few commits on it.
touch f2 git add . git commit -m "b" touch f3 git add . git commit -m "c" touch f4 git add . git commit -m "d" touch f5 git add .nf git commit -m "e"
-
Check the commit history.
git log --oneline
-
To checkrry pick only c and e commits to master.
git checkout master git cherry-pick c_commitid e_commitid