Cherry pick multiple commits from a remote or upstream branch into your local branch.
Saw this from a comment on an answer on Stack Overflow
git fetch upstream
git cherry-pick A^..B
where A
is the commit hash you want to start from (the ^
will include commit A
instead of starting at next commit after A
) and B
is the commit you want to end after being applied.
If you run into merge conflicts, it's a simple process of:
- manually fixing the merge conflicts
- committing your changes (you may need to do this several times if you use the
-p
option)
git add -p
- this will walk you through your changes and allow you to stage chunks instead of whole files so your commit messages can be more verbose/useful.git commit
- continue the cherry picking (
git cherry-pick --continue
)
๐ป