If only cherry picking the odd commit can do so directly using following:
git checkout master
git cherry-pick 62ecb3
The new commit 62ecb3 is applied to the master branch as a new commit through merge. Any conflicts has to be resolved.
For a range of commits, rebase is a better option.
Say we have two commits from a feature branch, 76cada and 62ecb3 and 62ecb3 is the head.
- Create a new branch from feature branch up until the last commit we want,
git checkout -b newbranch 62ecb3
- Then we rebase newbranch onto master:
git rebase --onto master 76cada^