I recently read this awesome git tutorial, about what is going on inside git for a day-to-day workflow like checkout, reset, branching, HEAD, commit etc. And I found myself in the bellow situation, when I remembered what I learned. Here’s the master branch:

master branch

And now, here’s my old_dev branch, on which I have some unmerged commits:

old dev branch

Suppose now that I only what the commit on which old_dev is pointing to (SHA d33957a). Where I to:

$ git merge old_dev

from master branch, I would add commit 9fdd36a, which is “buggy” (as the commit message says), and I don’t want that. Also, I may be required to resolve some merge conflicts manually. So to “pick” only a specific commit, one cherry-picks that commit only, once you’re on the branch you want to apply that commit onto:

$ git cherry-pick d33957a

Now the master branch only has the commit I wanted to add in the first place:

master branch with cherry-picked commit