Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The old diff, patch, and merge programs, and their modern descendents in the form of version control systems work great for managing source code that can be edited concurrently by multiple people.

They are, however, strictly line oriented, and thus tend to fall down flat on text that is more free form. In my particular case, I'm working with latex files edited by multiple people, and text is constantly reflowed -- adding or subtracting a word to a paragraph alters the line boundaries for the rest of the paragraph. There are diff tools that highlight changes within a line (many modern GUI ones), or even handle reflowed text (wdiff, git diff --word-diff). However, I've found nothing that handles three-way-merges or patching.

Does anyone know of a good tool that will do this automatically? (Yes, I could chop the text up so as to put each word (and run of white space) onto a separate line. Something like the format for git diff --word-diff=porcelain might not be a bad choice. But making this reversible and robust to an automated merge (including merge conflict markers) is not quite trivial).

Bonus points for a git merge driver.

share|improve this question
up vote 4 down vote accepted

Wiggle (git://neil.brown.name/wiggle) can do this, and has a Debian package

share|improve this answer
I had looked at this one before, but I couldn't actually get it to work. When I tried to do a three-way merge between ancestor:"a\nb c d\ne\n", branch1:"a\nb g c d\ne\n", and branch2:"a\nb c h d\ne\n", it spits out one of branch1 or branch2, claiming that a change had already been applied. It turns out that the documentation is misleading ("if three files are listed, they are taken to contain the given text and the two other texts, in order", and that the ancestor needs to be the middle of the three arguments. wiggle --merge --help clears this up. – wnoise Dec 7 '11 at 19:21

Your Answer


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

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