What does git cherry-pick <commit> do?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Cherry-picking in Git means choosing a commit from one branch and applying it to another.
This contrasts with other ways such as
mergeandrebasewhich normally apply many commits to another branch.It’s also possible to cherry-pick multiple commits but
mergeis the preferred way over cherry-picking.Make sure you are on the branch you want to apply the commit to.
Execute the following:
N.B.:
If you cherry-pick from a public branch, you should consider using
This will generate a standardized commit message. This way, you (and your co-workers) can still keep track of the origin of the commit and may avoid merge conflicts in the future.
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:
Additional links: