Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I've seen many blog posts and stack overflow posts say that git config --global diff.algorithm patience will allow both diffs and merges to use the patience strategy option with the default recursive algorithm.

I have found this to not be the case, and I pose the following demo to show why not.

git config --global diff.algorithm patience   //mythical config statement  

git clone https://github.com/kjlubick/PracticingGit.git
cd PracticingGit
git checkout origin/patience-merge-1 -t

git checkout merge_test           //temp branch for merging
git diff origin/patience-merge-2

image This diff (image courtesy of meld looks pretty good. Let's try to merge it in.

git merge origin/patience-merge-2

image

Huh? That merge looks ugly. Despite lines 9-19 not actually changing, they are marked as conflicted/changed in completely different way than with the diff.

If we force the merge to use the patience strategy option:

git merge --abort
git merge origin/patience-merge-2 -X patience

image

That's much better. The conflicts match up with the diff we made earlier and are semantically correct.

How can I make merging actually use the patience setting, not just diffs?

Additional shots in the dark I tried (unsuccessfully):

git config --global merge.algorithm patience
git config --global merge.diff.algorithm patience

System info:
Windows 8.1
git version 1.8.4.msysgit.0 (via GitHub for Windows 2.0)

share|improve this question

This question has an open bounty worth +50 reputation from KevinL ending in 2 days.

Looking for an answer drawing from credible and/or official sources.

    
The man page says this for the -s option: Use the given merge strategy; can be supplied more than once to specify them in the order they should be tried. If there is no -s option, a built-in list of strategies is used instead (git merge-recursive when merging a single head, git merge-octopus otherwise). This sounds like making this the default behavior is unlikely to be possible. –  Chris Hayes Aug 3 at 1:47
    
So perhaps it may be impossible via git config, but what about workarounds? Is there another way? –  KevinL yesterday

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.