[Ilugc] .a-tip-a-day (diff - differences between text files line by line)

  • From: rmathews@xxxxxxxxx (Roshan Mathews)
  • Date: Tue Sep 29 07:51:43 2009

On Tue, Sep 29, 2009 at 6:52 AM, Kapil Hari Paranjape <kapil@xxxxxxxxxxx> wrote:

Generally, one should prefer the command
?$ diff -u file.txt file-modified.txt

The reason is that this maintains the _context_ information of the
differences as a result:
?- the diff is more human readable
?- the diff is longer :-(
?- the diff can work with patch even when some unrelated changes
? have been made to file.txt after the diff was created

diff -c shows context.
diff -u is a GNU extension.

GNU's not Unix!

I prefer looking at the diff -u output.  But I remember there was some
project which explicitly stated that they must have diffs in "context"
not "unified" format.

Roshan Mathews

Other related posts: