How to cherry pick from 1 branch to another

michael picture michael · Mar 14, 2011 · Viewed 136.6k times · Source

I have 2 branches, master and dev.

I am on dev branch and I want to cherry-pick 1 commit from master to dev. So I did

$ git cherry-pick be530cec7748e037c665bd5a585e6d9ce11bc8ad
Finished one cherry-pick.

But when I do git status and gitx, I don't see my commit be530cec7748e037c665bd5a585e6d9ce11bc8ad in git history.

How can I see my commit in the dev branch?

Answer

CanSpice picture CanSpice · Mar 14, 2011

When you cherry-pick, it creates a new commit with a new SHA. If you do:

git cherry-pick -x <sha>

then at least you'll get the commit message from the original commit appended to your new commit, along with the original SHA, which is very useful for tracking cherry-picks.