Let's say I have two files.  The first one has the contents:line 1fooline 2line 1barline 2And the second one has a new section inserted in the middle, so it looks like this:line 1fooline 2line 1new textline 2line 1barline 2Now, when I do a diff -u, I get output like this:--- file1   2013-06-25 16:27:43.170231844 -0500+++ file2   2013-06-25 16:27:59.218757056 -0500@@ -1,7 +1,11 @@line 1fooline 2line 1+new text+line 2++line 1barline 2This doesn't properly reflect that the middle stanza was inserted -- instead, it makes it look like the second stanza was changed, and a new one added to the end (this is because the algorithm starts at the first differing line).Is there any way to get diff (either by itself, or using git diff) to show this output instead?--- file1   2013-06-25 16:27:43.170231844 -0500+++ file2   2013-06-25 16:27:59.218757056 -0500@@ -1,7 +1,11 @@line 1fooline 2++line 1+new text+line 2line 1barline 2This is mostly an issue when generating a patch for someone to review, where a new function gets inserted into a group of similar functions.  The default behavior doesn't reflect what really changed.
Getting diff (or git diff) to show inserted hunks properly
git;diff