I have two versions of a text file, with many changes (including whitespace, linebreak differences, etc.). All of the diff tools I have tried (diff, diff --minimal, wdiff, kdiff3, meld) fail spectacularly to even come close to properly aligning the two versions (it seems that they start lining things up from the beginning of the file, and once they are "out of sync", they never get back on track). Actually, the best diff tool I've found for this pair of files is the diff displayed inside gitk, but I don't know how to call it externally (and it is anyway only passable).

Is there any diff tool which will find a minimal set of changes between two files? (e.g. by using dynamic programming)

I am most interested in tools available on linux.

  • Be aware that the difftool and algorithm chosen are orthogonal, though some tools may have algorithms not natively present in git. Have you tried git diff --diff-algorithm=histogram? – MooseBoys Sep 23 '19 at 16:44

If we speak about Windows GUI differs, I have to say:

  • Most of modern diff-tools (which I saw and tried) have in settings (configurable) ignore "EOL|Whitespace changes"
  • Most of modern diff-tools can show inline changes (for not-ignored content)

P4Merge can detect (and show in interface in clean form) inserted|deleted chunks, do not converting into mess the rest part of file

CompareIt! have even more wide set of ignorable changes and concept of different "comparison profiles", regexps processing (didn't try yet, can't comment), "moved blocks" detection (and it works)

| improve this answer | |

Notepad++ has a comparison tool that works quite well for me. It seems to do a really good job of identifying the matches and calling out the true differences. Notepad++ is free to download and a very useful software for a myriad of other reasons as well.


| improve this answer | |
  • Please add the plugin name, its website, if its open source then also add the repository name and link. No need to reply this comment. – Biswapriyo Sep 3 '19 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.