Git - Cherry picking with ours/theirs strategy

11,846

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
Share:
11,846

Related videos on Youtube

Sazzad Hissain Khan
Author by

Sazzad Hissain Khan

Connect with me: LinkedIn Core technical expertise: Git, OOP, Java, iOS (Swift, Objective-C), Xcode, iOS Configurations, Android (Java, Kotlin), System Design, Application Architecture, Development Processes, Testability. Special interest: Information Theory, Astronomy, Probability, Theory of Relativity, Randomness I am a strong believer of simplicity and code clarity **Short Bio:** Throughout over 9 years of experience on mobile software development, I have acquired a deep understanding on how to overcome the real hurdles of developing performant, robust, testable and maintainable applications from the requirement analysis to the architecture, design, development, continuous integration and continuous deployment. I have a strong fascination for CLEAN coding and SOLID principles. Problem solving is my passion regardless if its design related or architectural and I value the passion for problem solving minds. Usability, especially user intuitive and interactive UX for front ends and fault tolerance for backends are my prime concerns on developing any product. More importantly I enjoy Software Engineering and solely believe that this profession suits best for me.

Updated on June 04, 2022

Comments

  • Sazzad Hissain Khan
    Sazzad Hissain Khan almost 2 years

    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.

  • Sazzad Hissain Khan
    Sazzad Hissain Khan over 6 years
    I tried, this didn't work for me. It always gives hints to apply after manual conflicts resolution. :(