Search code examples
gitcherry-pickgit-cherry-pick

Cherrypick all commits from remote branch starting at a tag


I'm working on an old project relying on a game, but the game updated a lot and I need to update my project to the newest version. I've tried simply merging both Repos, but there are so many changes, it's just chaos.

I'd like to cherrypick every commit (a few hundred) step by step to make sure no unwanted changes happen and maybe add a few changes on conflicts.

So the vanilla repo tags looks like:

 0.7.0
 0.7.1
 ...

How can I cherry-pick every commit from each tag?


Solution

  • From https://git-scm.com/docs/git-cherry-pick

    git rev-list --reverse master -- README | git cherry-pick -n --stdin
    

    If you change the rev-list to

    git rev-list --reverse 0.7.1 ^0.7.0
    

    it gives you all commits before 0.7.1, excluding all commits before 0.7.0, so basically all commits between 0.7.0 and 0.7.1. See the use of ^ here: https://git-scm.com/docs/git-rev-list#_description

    Those commits you could then pipe to cherry-pick to do its magic.