从 Git 存储库生成统计信息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1828874/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Generating statistics from Git repository
提问by BastiBen
I'm looking for some good tools/scripts that allow me to generate a few statistics from a git repository. I've seen this feature on some code hosting sites, and they contained information like...
我正在寻找一些好的工具/脚本,可以让我从 git 存储库生成一些统计信息。我在一些代码托管网站上看到过这个功能,它们包含的信息如...
- commits per author
- commits per day/week/year/etc.
- lines of code over time
- graphs
- ... much more
- 每个作者的提交
- 每天/每周/每年/等提交。
- 随时间推移的代码行
- 图表
- ... 多得多
Basically I just want to get an idea how much my project grows over time, which developer commits most code, and so on.
基本上,我只想知道我的项目随着时间的推移增长了多少,哪个开发人员提交的代码最多,等等。
采纳答案by Jakub Nar?bski
Beside GitStats(git history statistics generator) mentioned by xyld, written in Python and requiring Gnuplot for graphs, there is also
除了GitStats(git的历史统计生成的提及)xyld,用Python编写的,并要求为的Gnuplot图形,也有
- gitstat(SourceForge) project (web-based git statistics interface), written in PHP and Perl,
- Git Statistics, aka gitstats (metrics framework designed to gather statistics on git repositories), written in Python, result of git-statistics project at Google Summer of Code 2008This is not a web app
- gitinspectorIs a rather new, CLI based Python tool for generating nice reports
- Hercules- native app without dependencies, written in Go, which specializes in advanced analysis types.
- gitstat( SourceForge) 项目(基于 web 的 git 统计接口),用 PHP 和 Perl 编写,
- Git Statistics,又名 gitstats(用于收集 git 存储库统计信息的度量框架),用 Python 编写,是 Google Summer of Code 2008的git-statistics 项目的结果这不是一个网络应用程序
- gitinspector是一个相当新的、基于 CLI 的 Python 工具,用于生成漂亮的报告
- Hercules- 没有依赖关系的原生应用程序,用 Go 编写,专门研究高级分析类型。
回答by Ruslan Kabalin
commits per author
每个作者的提交
git shortlog -s -n
回答by tomgi
I'm doing a git repository statistics generator in ruby, it's called git_stats.
我正在用 ruby 做一个 git 存储库统计信息生成器,它叫做git_stats。
You can find examples generated for some repositories on project page.
您可以在项目页面上找到为某些存储库生成的示例。
Here is a list of what it can do:
以下是它可以做什么的列表:
- General statistics
- Total files (text and binary)
- Total lines (added and deleted)
- Total commits
- Authors
- Activity (total and per author)
- Commits by date
- Commits by hour of day
- Commits by day of week
- Commits by hour of week
- Commits by month of year
- Commits by year
- Commits by year and month
- Authors
- Commits by author
- Lines added by author
- Lines deleted by author
- Lines changed by author
- Files and lines
- By date
- By extension
- 一般统计
- 文件总数(文本和二进制)
- 总行数(添加和删除)
- 提交总数
- 作者
- 活动(总计和每位作者)
- 按日期提交
- 按一天中的小时提交
- 按星期几提交
- 按每周一小时提交
- 按年提交
- 按年提交
- 按年和月提交
- 作者
- 作者提交
- 作者添加的行
- 作者删除的行
- 作者更改的行
- 文件和行
- 按日期
- 通过扩展
If you have any idea what to add or improve please let me know, I would appreciate any feedback.
如果您有任何想法要添加或改进,请告诉我,我将不胜感激。
回答by Jeevan Pingali
I tried http://gitstats.sourceforge.net/, starts are very interesting.
我试过http://gitstats.sourceforge.net/,开始很有趣。
Once git clone git://repo.or.cz/gitstats.git
is done, go to that folder and say gitstats <git repo location> <report output folder>
(create a new folder for report as this generates lots of files)
一旦git clone git://repo.or.cz/gitstats.git
完成,进入该文件夹,并说gitstats <git repo location> <report output folder>
(报表创建一个新的文件夹,因为这会产生大量的文件)
Here is a quick list of stats from this:
这里是一个快速的统计列表:
- activity
- hour of the day
- day of week
- authors
- List of Authors
- Author of Month
- Author of Year
- files
- File count by date
- Extensions
- lines
- Lines of Code
- tags
- 活动
- 一天中的一个小时
- 星期几
- 作者
- 作者名单
- 月刊作者
- 年度作者
- 档案
- 按日期计算文件数
- 扩展
- 线
- 代码行
- 标签
回答by dlamotte
A quick google search lead me to: http://gitstats.sourceforge.net/
一个快速的谷歌搜索引导我到:http: //gitstats.sourceforge.net/
Have you tried this project? I'm sure there are similar projects.
你试过这个项目吗?我相信有类似的项目。
回答by lzap
回答by VonC
If your project is on GitHub, you now (April 2013) have Pulse(see "Get up to speed with Pulse"):
如果您的项目在 GitHub 上,那么您现在(2013 年 4 月)拥有Pulse(请参阅“了解 Pulse”):
It is more limited, and won't display allthe stats you might need, but is readily available for any GitHub project.
它更受限制,不会显示您可能需要的所有统计信息,但可用于任何 GitHub 项目。
Pulse is a great way to discover recent activity on projects.
Pulse will show you who has been actively committing and what has changed in a project's default branch:
Pulse 是发现项目最近活动的好方法。
Pulse 将向您显示谁一直在积极提交以及项目默认分支中发生了什么变化:
You can find the link to the left of the nav bar.
您可以在导航栏左侧找到链接。
Note that there isn't (yet) an API to extract that information.
请注意,目前还没有 API 来提取该信息。
回答by white_gecko
git-bars
can show you "commits per day/week/year/etc".
git-bars
可以显示“每天/每周/每年/等等的提交”。
You can install it with pip install git-bars
(cf. https://github.com/knadh/git-bars)
您可以使用pip install git-bars
(参见https://github.com/knadh/git-bars)安装它
The output looks like this:
输出如下所示:
$ git-bars -p month
370 commits over 19 month(s)
2019-10 7 ??????
2019-09 36 ???????????????????????????????
2019-08 7 ??????
2019-07 10 ????????
2019-05 4 ???
2019-04 2 ?
2019-03 28 ????????????????????????
2019-02 32 ????????????????????????????
2019-01 16 ??????????????
2018-12 41 ???????????????????????????????????
2018-11 52 ?????????????????????????????????????????????
2018-10 57 ??????????????????????????????????????????????????
2018-09 37 ????????????????????????????????
2018-08 17 ??????????????
2018-07 1
2018-04 7 ??????
2018-03 12 ??????????
2018-02 2 ?
2016-01 2 ?
回答by alexandrul
repostatis an enhanced fork of gitstats tool.
repostat是 gitstats 工具的增强分支。
I'm not sure if it's in any way related to the project with the same name on pypi, so your best bet is to download the latest release from GitHuband install it in your Python environment.
我不确定它是否与 pypi 上的同名项目有任何关系,因此最好的办法是从GitHub下载最新版本并将其安装在 Python 环境中。
As of November 2019, I was able to use v1.2.0 under Windows 7, after making gnuplot available in PATH.
截至 2019 年 11 月,在 PATH 中提供 gnuplot 后,我能够在 Windows 7 下使用 v1.2.0。
usage: repostat [-h] [-v] [-c CONFIG_FILE] [--no-browser] [--copy-assets]
git_repo output_path
Git repository desktop analyzer. Analyze and generate git statistics in HTML
format
positional arguments:
git_repo Path to git repository
output_path Path to an output directory
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-c CONFIG_FILE, --config-file CONFIG_FILE
Configuration file path
--no-browser Do not open report in browser
--copy-assets Copy assets (images, css, etc.) into report folder
(report becomes relocatable)
回答by Alexej Sailer
Just yesterday I've added my git-analytics docker-compose file, which builds up several containers to start analyzing multiple git repositories against each other.
就在昨天,我添加了我的 git-analytics docker-compose 文件,该文件构建了多个容器以开始相互分析多个 git 存储库。
It is able to show you commit statistics over time about the author and also several diff statistics.
它能够向您显示关于作者的随时间提交的统计数据以及一些差异统计数据。
You can use the provided angular client and also kibana to visualize the statistics.
您可以使用提供的 angular 客户端和 kibana 来可视化统计信息。
https://github.com/alexejsailer/git-analytics-docker
https://github.com/alexejsailer/git-analytics-docker
It will be improved over time.
随着时间的推移它会得到改善。