Git - Cherry picking with ours/theirs strategy

I wonder if there is any way of cherry picking with ours/theirs strategy. On other words, I want to cherry pick multiple commits from dev branch into main branch with below commands,

git cherry-pick HASH1 HASH2 HASH3 -n

This command is supposed to take all referred commits and prepare unstaged changes if no conflicts. However, if conflicts, I need to resolve and continue cherry-picking. For all conflicts, my intention is to pick whatever in the dev (which means, --strategy-option = ours).

Is there any way to provide such option while cherry-picking.

1 Answer

The git cherry-pick command does have the --strategy and --strategy-option=<option> options.

They are passed through to the merge strategies.

So, in your case:

git cherry-pick --strategy-option=ours HASH1 HASH2 HASH3 -n
7

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like