0

How do I see all the commits by a particular author, sorted by gross (not net) changes? I want the output to be somewhat human-readable; something like:

+153 -34 abcd123 First commit
+140 -40 zyxw987 Another, smaller commit
...
Camelid
  • 1,535
  • 8
  • 21
  • Does this help? https://stackoverflow.com/questions/12174276/github-list-commits-by-author – theWellHopeErr Nov 28 '20 at 04:09
  • No, I already knew about that feature. I am looking for something *on the command-line* that will provide a *list of commits sorted by gross changes*. – Camelid Nov 28 '20 at 04:22
  • By gross do you mean changes in all branches? – theWellHopeErr Nov 28 '20 at 04:28
  • Git will show you the total lines added and removed for a commit. By "gross" I mean the total lines added plus the total lines removed. For example, the gross changes in `+153 -34` would be `153 + 34 = 187`. – Camelid Nov 28 '20 at 04:47

1 Answers1

3

You could view this all through the log.

First filter by the author: --author=[name]
Include the shortstat for changes: --shortstat
Get the hash and subject: --format="%h %s"

Which outputs lines like this:

$ git log --author=john --shortstat --format="%h %s"
6d8ab99 some message

 14 files changed, 625 insertions(+), 78 deletions(-)
8859aa7 another message

 4 files changed, 6 insertions(+), 3 deletions(-)
40f9573 stuff

 31 files changed, 461 insertions(+), 9 deletions(-)
0dd757c lots of stuff

 5 files changed, 42 insertions(+), 21 deletions(-)

Then extract and format as needed then sort. I don't know how to get there from here so I'll leave that part up to you. :)

Jeff Mercado
  • 129,526
  • 32
  • 251
  • 272