Skip to content
Justice Tech School

Cherry Pick

git cherry-pick copies one commit onto the current branch.

Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
git switch -q -c feat
echo f > f.txt && git add f.txt && git commit -qm 'feat only'
git switch -q main
git cherry-pick feat >/dev/null
git log --format=%s -n 1

Result

feat only

Exercise

Copy a commit.

git  commit

Quiz Test

What does cherry-pick do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.