smartmeter-app/git_statistic.sh
2023-12-05 16:45:28 +08:00

18 lines
610 B
Bash

#!/bin/bash
# 获取今天的日期
TODAY=$(date +"%Y-%m-%d")
# 使用今天的日期初始化起始和结束日期
SINCE="$TODAY 00:00:00"
UNTIL="$TODAY 23:59:59"
authors=$(git log --pretty=format:'%an' | LC_ALL=C sort | uniq)
for author in $authors; do
echo "Author: $author"
echo "时间段: $SINCE - $UNTIL"
git log --author="$author" --since="$SINCE" --until="$UNTIL" --pretty=tformat: --numstat | awk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf "增加行数: %s, 删除行数: %s, 总修改行数: %s\n", add, subs, loc }'
echo "---------------------------------"
done