3 Star 18 Fork 20

peipeihh/simple-demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

1. 简介

本项目演示如何通过脚本批量分析多个Git代码仓库,按提交人归类,获取代码行数变更数量。

更多详细介绍,请见博客文章一个统计Git代码仓库签入代码行数的批量统计脚本

2. 项目结构

整个工程结构如下,

+ simpleCmd.sh 针对单个代码仓库的代码行数统计
+ analyzeGitRepo.sh 批量分析脚本
+ repoList.txt 代码仓库列表

4. 演示

下载代码后,直接运行如下命令,

sh ./analyzeGitRepo.sh "2020-01-01" "2021-07-20"

analyzeGitRepo将按行读取代码仓库,并进行统计分析,最后输出代码行数变更数量(按提交人)。

一个输出结果如下,

% sh ./analyzeGitRepo.sh "2020-01-01" "2021-07-20"
the period of analysis: sinceDate = 2020-01-01, untilDate = 2021-07-20

start to clone the repository: git@gitee.com:pphh/simple-demo.git, branch = master, folder = ./1-repo-master
Cloning into './1-repo-master'...
remote: Enumerating objects: 1182, done.
remote: Counting objects: 100% (279/279), done.
remote: Compressing objects: 100% (195/195), done.
remote: Total 1182 (delta 66), reused 0 (delta 0), pack-reused 903
Receiving objects: 100% (1182/1182), 306.24 KiB | 1.76 MiB/s, done.
Resolving deltas: 100% (267/267), done.
clone is completed!
try to investigate the submission status of the repository: git@gitee.com:pphh/simple-demo.git, branch = master

start to clone the repository: git@gitee.com:pphh/blog.git, branch = master, folder = ./2-repo-master
Cloning into './2-repo-master'...
remote: Enumerating objects: 357, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 357 (delta 2), reused 0 (delta 0), pack-reused 351
Receiving objects: 100% (357/357), 2.16 MiB | 1.82 MiB/s, done.
Resolving deltas: 100% (88/88), done.
clone is completed!
try to investigate the submission status of the repository: git@gitee.com:pphh/blog.git, branch = master

name	new-code-lines	delete-code-lines	all
peipeihh 1586 0 1586
huangyh 0 0 0

分析的报告同时也输出到了目录下的finalReport.txt文件。

每列的数字意义如下,

  1. 第一列:代码提交人
  2. 第二列:提交的新增代码行数
  3. 第三列:提交的删除代码行数
  4. 第四列:所有提交的代码行数

5. 联系 Contact

邮箱地址:peipeihh@qq.com,欢迎来信联系。

更多的信息,可以访问博客地址:hyhblog.cn

6. 开源许可协议 License

Apache License 2.0

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/pphh/simple-demo.git
git@gitee.com:pphh/simple-demo.git
pphh
simple-demo
simple-demo
master

搜索帮助