初始化

This commit is contained in:
chenyc
2025-12-13 18:52:08 +08:00
commit 9041a4298f
553 changed files with 59783 additions and 0 deletions

54
measure_lines.sh Normal file
View File

@@ -0,0 +1,54 @@
#!/bin/bash
# 设置变量
user="zhangchen"
start_date="2025-01-01T00:00:00"
end_date="2025-03-01T23:59:59"
# 检查当前目录是否是Git仓库
if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
echo "当前目录不是一个Git仓库。请在Git仓库的根目录下运行此脚本。"
exit 1
fi
# 获取提交次数
commit_count=$(git log --author="$user" --since="$start_date" --until="$end_date" --pretty=oneline | wc -l)
# 获取代码行数的变化
lines_info=$(git log --author="$user" --since="$start_date" --until="$end_date" --pretty=tformat: --numstat | awk '{ add += $1; del += $2; net += $1 - $2 } END { printf "%s,%s,%s", add, del, net }')
IFS=',' read lines_added lines_deleted lines_changed <<< "$lines_info"
# 输出结果
echo "日期: $start_date ~ $end_date"
echo "用户: $user"
echo "提交次数: $commit_count"
echo "增加的代码行数: $lines_added"
echo "删除的代码行数: $lines_deleted"
echo "净变化的代码行数: $lines_changed"
#!/bin/bash
# 设置变量
user="zhangchen"
start_date="2025-01-01T00:00:00"
end_date="2025-04-10T23:59:59"
# 检查当前目录是否是Git仓库
if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
echo "当前目录不是一个Git仓库。请在Git仓库的根目录下运行此脚本。"
exit 1
fi
# 获取提交次数
commit_count=$(git log --author="$user" --since="$start_date" --until="$end_date" --pretty=oneline | wc -l)
# 获取代码行数的变化
lines_info=$(git log --author="$user" --since="$start_date" --until="$end_date" --pretty=tformat: --numstat | awk '{ add += $1; del += $2; net += $1 - $2 } END { printf "%s,%s,%s", add, del, net }')
IFS=',' read lines_added lines_deleted lines_changed <<< "$lines_info"
# 输出结果
echo "日期: $start_date ~ $end_date"
echo "用户: $user"
echo "提交次数: $commit_count"
echo "增加的代码行数: $lines_added"
echo "删除的代码行数: $lines_deleted"
echo "净变化的代码行数: $lines_changed"