Re: Sort output of diff --stat?
- From
Jeff King <peff@peff.net>
- Date
- Oct 17, 2018, 18:47 UTC
- Message-ID
- <20181017184720.GF28326@sigill.intra.peff.net>
- In-Reply-To
- <CAHd499BSVRytaFKOUhE=A4Zv+MMx=uKrWKUcT13QwzOCZWhEtg@mail.gmail.com>
On Wed, Oct 17, 2018 at 01:15:18PM -0500, Robert Dailey wrote:
Show 5 quoted lines
> I'd like to sort the output of `git diff --stat` such that files are > listed in descending order based on number of lines changed. The > closest solution I've found online[1] has several readability issues. > I'd rather see a built-in solution in git, if one exists. Can anyone > recommend a solution?
Hmm, I feel like another person asked for this recently, but I can't seem to find the thread.
Anyway, no, I don't think there's a solution short of parsing the output (you could parse --numstat, which is at least sane, but then you'd have to generate your own visual diffstat, which has a lot of corner cases).
We have --orderfile, but that's about a static order based on filename. It seems reasonable to me for "--stat" to learn an option to sort (that would not affect, say, the total diff order, since sorting by line count makes very little sense for most other formats).
-Peff