I want to get a high quality diff and I am not worried about how long it will take, e.g.
git merge --strategy-option=diff-algorithm=minimal develop
From the docs, Its not clear which one is best for which situations?
default, myers The basic greedy diff algorithm. Currently, this is the default.
minimal Spend extra time to make sure the smallest possible diff is produced.
patience Use "patience diff" algorithm when generating patches.
histogram This algorithm extends the patience algorithm to "support low-occurrence common elements".
There is a summary of the patience algorithm in another answer.
--strategy-option=patience
and --strategy-option=diff-algorithm=patience
equivalent?Recursive. This operates on two heads. 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.
When GitHub creates merge commits, like to test whether a pull request can be merged cleanly or to actually merge a pull request, it now uses the merge-ort strategy.
You should always use histogram and not worry about it. The vast majority of the time all algorithms will give the exact same results, but once in a great while there will be an XML file or a heavily edited C file with lots of curly brackets where myers and minimal will merge up meaningless repeated sections of the file and have a completely broken and unusable output with unrelated sections of code on either side of conflict sections. Both patience and histogram will handle those cases fine, but histogram runs faster. Since histogram is both the best and fastest algorithm, there isn't much reason to use anything else.
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