Git 2.9 was released earlier this year which included the experimental flag --compaction-heuristic
on the git diff
command:
In 2.9, Git's diff engine learned a new heuristic: it tries to keep hunk boundaries at blank lines, shifting the hunk "up" whenever the bottom of the hunk matches the bottom of the preceding context, until we hit a blank line.
I don't think GitHub has it enabled for diffs on the web UI for Pull Requests and comparisons, but you can do it locally. I'd recommend using it in conjunction with --word-diff
if you need that level of granularity.
More details available on the GitHub blog: https://github.com/blog/2188-git-2-9-has-been-released
Add the parameter --unified=0
to show the names of each file.
The --unified
part sets the output format to 'unified'. The unified format starts with the names of the files being compared.
The =0
part hides the context lines. It makes the output easier to inspect visually.
Rerun the original command with the new parameter and the output will look like this:
--- /home/sandport/riak/dev/dev1/etc/app.config 2013-12-11 02:40:09.000000000 +0000
+++ /home/sandport/riak/dev/dev2/etc/app.config 2013-12-11 02:40:09.000000000 +0000
@@ -11 +11 @@
- {http, [ {"127.0.0.1", 8091 } ]},
+ {http, [ {"127.0.0.1", 8092 } ]},
@@ -15 +15 @@
- %{https, [{ "127.0.0.1", 8091 }]},
+ %{https, [{ "127.0.0.1", 8092 }]},
@@ -26 +26 @@
- {handoff_port, 8101 },
+ {handoff_port, 8102 },
@@ -54 +54 @@
- {pb_port, 8081 },
+ {pb_port, 8082 },
--- /home/sandport/riak/dev/dev1/etc/app.config 2013-12-11 02:40:09.000000000 +0000
+++ /home/sandport/riak/dev/dev3/etc/app.config 2013-12-11 02:40:09.000000000 +0000
[...]
Best Answer
Yes, use Tom Dickey's diffstat:
You can summarise any (well, most) diffs / patches with it, not just directory diffs.