I can cherry pick a range of sequent commit .
for example
on branch master,I want to cherry-pick changes from d4fd8cad to HEAD of develop
git cherry-pick d4fd8cad..develop
There is an errorr
error: Commit 885c9e07264ac6b5d3960... is a merge but no -m option was given.
fatal: cherry-pick failed
how can I use the -m option ?
In this case it might be better to use an interactive rebase.
To apply d4fd8cad..HEAD from branch develop to master, you can use the following command.
Make sure we are standing in develop:
git checkout develop
Branch out of develop:
git checkout -b develop-rebase
Do an interactive rebase on master. The -p option lets you keep the merge commits.
git rebase master -i -p
Delete all the lines with commits before d4fd8cad. Leaving you with the commits you wanted to cherrypick.
Save the rebase file.
Resolve conflicts, if any.
Now you have a branch that look exactly like you want your master branch to look. Take a look in gitk
to verify if you want.
Now all we have to do is merge this into master. If this is not a fast-forward merge, something wrong has probably happened, so let's add the --ff-only flag
git checkout master
git merge develop-rebase --ff-only
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