diffstat: the first thing to reach for when reviewing a big PR

When you're staring at a 5000-line diff, your eyes glaze over before you've read past the first file. diffstat gives you the bird's-eye view in one screen:

gh pr diff 137 | diffstat
 lib/relay-runtime.sh      | 2692 -----------------------------------
 lib/relay/backends.sh     |  142 ++++
 lib/relay/cli.sh          |  326 +++++++
 lib/relay/cycle.sh        |   99 ++
 lib/relay/issue-comments..|  179 ++++++
 lib/relay/issues.sh       |  173 ++++++
 lib/relay/project-regist..|  274 ++++++++
 lib/relay/session.sh      |  692 ++++++++++++++++++++++++++
 lib/relay/telegram.sh     |  389 ++++++++++++++++
 lib/relay/tmux-send.sh    |  337 +++++++++++++++
 lib/relay/worktree.sh     |  206 ++++++++
 11 files changed, 2848 insertions(+), 2686 deletions(-)

From that one output you can immediately see: this is a file split (one huge file → ten smaller ones), the net change is roughly neutral, and session.sh is the biggest new file at 692 lines. That's enough to form a review strategy before reading a single line of diff.

It also works with local diffs:

git diff main..my-branch | diffstat

Install on Debian/Ubuntu:

sudo apt install diffstat

Comments

  1. Markdown is allowed. HTML tags allowed: <strong>, <em>, <blockquote>, <code>, <pre>, <a>.