I need to cherry pick a range of commits, where I found commits like this:
Merge "TICKET-100: Some commit message" into master
< some other commits >
TICKET-100: Some commit message
I checked the content and its the same for both commits. Can I only cherry pick the first, and ignore the one starting with "Merge"? How are they related?
Lets assume you have something like this:
X - master
|
|
M
|\
| \
X B - merged_feature_branch
| |
| |
X A X - cherry_pick_destination
| / |
|/ |
X X
| /
| /
Now you have two choices:
A
and B
M
against first parent (-m 1
)Both solution will introduce same change, but IMHO first approach is more readable.
In case if some conflicts where resolved when committing M
then second option may be preferred..
If you have to cherry-pick a range of commits without the merge commits, rather than doing
git cherry-pick A..B
You can put the range into a subcommand where you suppress merge commits :
git cherry-pick $(git rev-list --no-merges A..B)
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