Home > Blockchain >  How to make `git shortlog --sumary` use author-date instead of commit-date?
How to make `git shortlog --sumary` use author-date instead of commit-date?

Time:12-17

We use extensively git shortlog --summary --after='2022-01-01 00' --before='2022-12-31' in our end of year reviews and statistics.

$ git shortlog --summary --after='2022-01-01 00' --before='2022-12-31'`
   300  John
    90  Jane
    30  Jack
$ git shortlog --summary --after='2021-01-01 00' --before='2021-12-31'`
   (empty)

Unfortunately the data is wrong.

In 2022 John had zero commits and Jane had around 20 and John and Jack had around 10 commits each in 2021.

We tracked this to the history rewrites that were done in 2022, and that git shortlog --summary uses the commit-date of the commits (which a lot of them now show the year 2022).

Is there a way to make git shortlog --sumary use the commit author-date instead?

We have scoured the git-log and the git-shortlog man pages but no luck...

CodePudding user response:

You can try now Git 2.39 with

  • --group option to use any grouping parameters
  • and due to

git shortlog" learned to group by the "format" string

you can have something like (TBT!!!) git shortlog --date='format:%Y' --group='

  •  Tags:  
  • git
  • Related