Possible Duplicate:
How to cherry pick a range of commits and merge into another branch
I want to cherry-pick 19 commits from one branch and apply them to another branch. All of the commits are sequential (commit 1, commit 2 ... commit 19), and the last commit is not the most recent commit (i.e. there are other commits that come after it whose changes I don't want to apply). How can I apply my changes to a branch without typing git cherry-pick
for each commit?
Failure to this, cherry-picking can cause duplicate commits and users are encouraged to use git merge in scenarios where it is risky. PS: The branch you cherry-pick from should be deleted, cherry-pick the commits into two or more different branches then delete the faulty branch to avoid code duplication.
Cherry-pick multiple Git commits Since Git 1.7. 2, you can cherry-pick a range of commits by using the dot notation. Note that using this command, the commit A will NOT be included into the cherry-pick. For example, back to the “master” branch, let's try to cherry-pick two commits into the feature branch.
git cherry-pick $from_sha..$to_sha
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With