Generally, cherry picking in git means to choose a particular commit from one branch and apply it onto another. In contrast
rebase apply normally many commits onto another branch.
If you are a console fan and do not use any graphical interfaces working with git, proceed as follow for cherry-pick:
- Make sure you are on the branch you want to apply the commit to.
git checkout master
- Execute the following to pick a commit:
git cherry-pick <commit-hash>
Also note following:
- If you cherry-pick from a public branch, you should better use
git cherry-pick -x <commit-hash>
This will generate a standardized commit message. This way, you and your co-workers can still keep track of the origin of the commit.
- If you have notes attached to the commit they do not follow the cherry-pick. To bring them over as well, You have to use:
git notes copy <from> <to>
More about cherry-pick can be found at git official guide page.