serhii.net

In the middle of the desert you can say anything you want

22 Jan 2025

Cherry-pick range of commits in git

git - How to cherry-pick multiple commits - Stack Overflow:

For one commit you just pase its hash.
For multiple you list them, in any order.
For a range, you do oldest-latest but add ~, ^ or ~1 to the oldest to include it. Quoting directly from the SO answer:

# A. INCLUDING the beginning_commit
git cherry-pick beginning_commit~..ending_commit
# OR (same as above)
git cherry-pick beginning_commit~1..ending_commit
# OR (same as above)
git cherry-pick beginning_commit^..ending_commit 

# B. NOT including the beginning_commit
git cherry-pick beginning_commit..ending_commit
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus