git cherry picking
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:
And now, here’s my old_dev
branch, on which I have some unmerged commits:
Suppose now that I only what the commit on which old_dev is pointing to (SHA d33957a). Where I to:
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:
Now the master
branch only has the commit I wanted to add in the first place: