Rahul Rahul - 1 year ago 71
Git Question

What does cherry-picking a commit with git mean?

Recently, I have been asked to cherry pick a commit. But I have no idea what it means. So what does

cherry picking
a commit in git mean? How do you do it?

Answer Source

Cherry picking in git means to choose a commit from one branch and apply it onto another.

This is in contrast with other ways such as merge and rebase which normally applies many commits onto a another branch.

  1. Make sure you are on the branch you want apply the commit to.

    git checkout master

  2. Execute the following:

    git cherry-pick <commit-hash>

    Read more about it.