I use cherry pick in a number of situations, for example imagine I an in a feature branch and I encounter a minor bug unrelated to the feature I’m working on. I fix the bug and commit, but only then realise I should have comitted it to master instead so everyone gets the fix.
In this situation I would stash or commit my work in progress on the current branch. Checkout master and cherry pick the single commit which fixed the bug. I can then go back to my branch, revet the bug fix commit and rebase from master (however normally I would just leave the bug fix and get on with it!).
1 2 3
Merging in part of a pull request Sometimes Github pull requests contain more commits than you want to merge, instead of letting Github handle the pull request, do it yourself:
1 2 3 4 5