gitgit-cherry-pick

Whats a good method to cherrypick all missing commits by an author in one branch to another


Say I have made a bunch of changes in master. But, I want to cherrypick all the ones not in branch:release-5 onto to it.


Solution

  • You can cherry pick, but it would be much easier if you rebase:

    git checkout -b missing-commits master
    git rebase -i --author=me release-5
    

    All the commits already in release-5 won't be picked, and only your commits will. Afterwards you can merge the branch missing-commits into release-5.

    That being said you can use cherry-pick:

    git cherry-pick --skip-empty --cherry-pick --no-merges --right-only --topo-order --do-walk master...release-5
    

    As you can see it's much easier to use git rebase, which interally does the cherry-picking for you.