Gitstats git historical statistics tool

GitStats - Git historical statistics tool

2020-07-212020-07-21 10:31:28 read 1.1K0

If you are a member of the R & D effectiveness team or engaged in CI/CD or DevOps, in addition to providing infrastructure, indicators and data are also a very important link. For example, you need to analyze the code submission of a Git warehouse:

  • Who submitted the most codes for the warehouse
  • What is the activity of the warehouse like
  • Submit analysis data for each period
  • Contribution ranking of each version
  • Weekly / monthly / annual contribution ranking, etc

A few days ago, I found a Git historical statistics generation tool called gitstats( http://gitstats.sourceforge.net/ )

This is a very powerful analysis tool written in python with little code. It is also one of the few open source projects I have found that can generate beautiful reports and use them easily.

The gitstats report is also powerful( https://github.com/tomgi/gitstats )Interested can try

How to use

Installation dependencies: Git, Python, Gnuplot.

If you have Linux, it is recommended to download and install it on Linux. I have tried to prepare the environment with Windows. It is very troublesome to download Python 2, configure Cygwin, and manually configure Gnuplot (Gnuplot is a portable command-line driven graphics tool). Here are my installation and use steps on Linux.

# Download Python 2
sudo yum -y install python27
# Install Gnuplot
sudo yum -y install gnuplot
# Download gitstats
git clone https://github.com/hoxu/gitstats.git
# Download the code warehouse you want to analyze
git clone https://github.com/alibaba/fastjson.git
# Execute command, production report
cd gitstats
./gitstats ../fastjson ../html/fastjson
# After 15 seconds of execution, a report is generated
Generating report...
[0.00393] >> git --git-dir=/workspace/gitstats/.git --work-tree=/workspace/gitstats rev-parse --short HEAD
[0.00236] >> git --version
[0.00716] >> gnuplot --version
Generating graphs...
[0.01676] >> gnuplot "/workspace/html/fastjson/day_of_week.plot"
[0.01571] >> gnuplot "/workspace/html/fastjson/files_by_date.plot"
[0.01281] >> gnuplot "/workspace/html/fastjson/month_of_year.plot"
[0.09293] >> gnuplot "/workspace/html/fastjson/lines_of_code_by_author.plot"
[0.01340] >> gnuplot "/workspace/html/fastjson/commits_by_year.plot"
[0.01799] >> gnuplot "/workspace/html/fastjson/hour_of_day.plot"
[0.01627] >> gnuplot "/workspace/html/fastjson/domains.plot"
[0.01268] >> gnuplot "/workspace/html/fastjson/commits_by_year_month.plot"
[0.09435] >> gnuplot "/workspace/html/fastjson/commits_by_author.plot"
[0.01522] >> gnuplot "/workspace/html/fastjson/lines_of_code.plot"
Execution time 15.16208 secs, 4.58247 secs (30.22 %) in external commands)
You may now run:

sensible-browser '/workspace/html/fastjson/index.html'

Report analysis

General statistics

You can see that this project is called fastjson. It has been 3060 days and 893 active days since the first code Submission on July 31, 2011. The total number of files is 2960, and the total number of lines of code is 250000.

Activity

Number of submissions per hour per day, per day per week, per hour per week, per month per year, per year.

In the past 32 weeks, the first 12 to 17 weeks have been very active and submitted a lot. In addition, we can see that there are few submissions between 12:00 and 20:00 during the day. Most programmers are dealing with the work of the company during this time and are unable to contribute to open source projects.

After 20 p.m., submissions began to increase. It seems that he is a very hard-working developer. In addition, you can see that there are submissions from Monday to Sunday. Saturday is relatively the least. It should be Saturday to rest and relax. There are obviously more submissions on Sunday than on Saturday. It seems that it took a lot of valuable personal weekend time.

It can also be seen that the project is mainly completed from 2016 to 2017, and the time zone for completion is the East eighth district. This dimension can analyze the contribution of developers in different regions.

contributor

List all authors, number of submissions, first submission and last submission.

This picture also shows who is the creator of the project and who has contributed the most every year in recent years. You can also see the email account used by the submitter.

Number of files and lines

The total number of files is 2960, and the number of code lines is 250000.

In addition, you can also see the trend chart of file increase every year and the ranking of the number of these file types. You can see that java files account for 96.08%, followed by json.

Tags

Tag s is a very important analysis indicator for the team (provided that the warehouse to be analyzed creates Tags after the release). You can see the contribution ranking of each version.

last

  1. If you are interested, you can analyze your own project or go to GitHub to find an interesting and influential project for analysis, such as 996.ICU and vue.
  2. To facilitate team members' access, it is recommended to create an automated task that can be executed regularly by Jenkins to obtain the latest Git history, and then put the generated html on a Tomcat service so that all team members can access it.

This article is from WeChat official account. DevOps siege lion (DevOps Engineer) , by Peter Shen

The source of the original text and reprint information are detailed in the text. If there is infringement, please contact us

Keywords: Linux Operation & Maintenance server

Added by twinzen on Wed, 24 Nov 2021 14:50:35 +0200