Viewing git commit Results Split by Time Range
This note explains how to inspect Git commit results within a specific time range.
[01] shortlog
A command that provides a summarized view of
git logoutput.
[02] Check Commit Authors and Counts Within a Period
1
2
3
4
5
6
7
git shortlog -sne --since={$date} --before={$date}
# ex) commit count per contributor during 2022
root@master:~/tools# git shortlog -sne --since="01 Jan 2022" --before="30 Dec 2022"
198 aaa <aaa@naver.com>
65 bbb <bbb@naver.com>
48 ccc <ccc@naver.com>
[03] Check the Total Commit Count Within a Period
Combine with the awk command.
1
2
3
4
5
6
7
8
9
10
11
12
# current branch
git shortlog -sne --since={$date} --before={$date} | awk '{sum += $1} END {print sum}'
# all branch
git shortlog --all -sne --since="01 Jan 2022" --before="30 Dec 2022" | awk '{sum += $1} END {print sum}'
# without merge commit
git shortlog --all --no-merges -sne --since="01 Jan 2022" --before="30 Dec 2022" | awk '{sum += $1} END {print sum}'
# ex) total commit count during 2022
root@master:~/tools# git shortlog -sne --since="01 Jan 2022" --before="30 Dec 2022" | awk '{sum += $1} END {print sum}'
311
-
--allpulls log information from all branches in the current repository. -
--no-mergesexcludes commits created by merging between branches.
Reference: Git-shortlog
Reference: Git number of commits per author on all branches