What are the merge strategies?


Merge strategies is a method to find out the common base commit while merging two branches on git.

Some of merge strategies:

  1. Recursive: this operates on two heads. recursive is the default merge strategy when pulling or merging one branch.


git merge -s recursive branch1 branch2
  1. Resolve: This can only resolve two heads using a 3-way merge algorithm. This tries to carefully detect criss-cross merge ambiguities and is considered as safe and fast.


git merge -s resolve branch1 branch2
  1. Octopus: This resolves more than two heads, but refuses to do complex merge that needs manual resolution. It is primarily used for bundling topic branch heads together. This is default merge strategy when pulling or merging more than one branches.
  2. Ours: This resolves any number of heads, but the result of the merge is always the current branch head.
  3. subtree: This is modified recursive strategy. When merging trees A and B, if B corresponds to subtree of A. Then B is first adjusted to match the tree structure of A.

How useful was this post?

Click on a star to rate it!

One thought on “What are the merge strategies?

Leave a Reply

Your email address will not be published. Required fields are marked *