Change merge strategy from 'ort' to 'recursive'

I don't know how, but default merge strategy is ort in my pc, but I want to change that to recursive. I referred some online sources but none of them were useful. Can someone tell me how can I change my default merge strategy?

Upvotes: 1

Views: 6272

Answers (2)

Amit Choukroun
Amit Choukroun

Reputation: 543

TLDR; set environment variable GIT_TEST_MERGE_ALGORITHM=recursive

Found out in the source code of git it check first for environment variable GIT_TEST_MERGE_ALGORITHM

once setting the value to recursive it change the default merge strategy. I don't think it's the cleanest solution because of the TEST in the environment variable (probably meant for testing) but it's better then nothing.

Upvotes: 1

torek
torek

Reputation: 489333

You can't:1 the default merge strategy for git merge, git cherry-pick, etc., is hard-coded.2 You can easily run git merge -s recursive, either manually or through an alias.

The -s recursive and -s ort strategies are supposed to produce the same result except when -s recursive would bail out but -s ort can succeed. If you come across cases where this isn't true, report them to the Git developers.


1For some definition of "can't" anyway: if you work hard enough at it, you certainly could. For instance, just clone Git and customize it.

2For git merge in particular, the default is octopus when giving multiple heads, and otherwise is whichever of ort or recursive it is for your particular Git version.

Upvotes: 0

Related Questions