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 -b merge_test //temp branch for merging
git diff origin/patience-merge-2
This diff (image courtesy of meld looks pretty good. Let's try to merge it in.
git merge origin/patience-merge-2
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
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)
Recursive is the default merge strategy when pulling or merging one branch. Additionally this can detect and handle merges involving renames, but currently cannot make use of detected copies. This is the default merge strategy when pulling or merging one branch.
Myers. Myers algorithm was developed by Myers (1986). In the git diff command, this algorithm is used as the default. The operation of this algorithm traces the two primary identical sequences recursively with the least edited script.
ort. This is the default merge strategy when pulling or merging one branch. This strategy can only resolve two heads using a 3-way merge algorithm.
The merge-ort strategy is a from-scratch rewrite with the same concepts (recursion and rename-detection), but solving many of the long-standing correctness and performance problems. The result is much faster. For a merge (but a large, tricky one containing many renames), merge-ort gains over a 500x speedup.
What is Diffing Algorithm ? React uses virtual DOM which is a lightweight version of the DOM. The only difference is the ability to write the screen like the real DOM, in fact, a new virtual DOM is created after every re-render. DOM stores the components of a website in a tree structure.
This is the default merge strategy when pulling or merging more than one branch. This resolves any number of heads, but the resulting tree of the merge is always that of the current branch head, effectively ignoring all changes from all other branches.
The merge algorithm therefore considers the reverted change as no change at all, and substitutes the changed version instead.
This is the default merge strategy when pulling or merging more than one branch. This resolves any number of heads, but the resulting tree of the merge is always that of the current branch head, effectively ignoring all changes from all other branches. It is meant to be used to supersede old development history of side branches.
Patching git, like Appleman1234 is not ideal. I hope this feature comes in future versions.
For now, I think I'll have to settle for the alias
git config --global alias.pmerge "merge -X patience --"
which allows me to do
git pmerge origin/patience-merge-2
instead of
git merge origin/patience-merge-2 -X patience
in the example I gave earlier.
There is a config item for branch-specific merge options,
git config branch.master.mergeoptions "-X patience"
but not a global default setting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With