CPQ

Paul Ching

git-commit-analytics

Paul Ching2022/1/2 16:00:00

This article was last updated 2 years 10 months ago, and some content may be legacy. Please use it for reference only.

A tool to analyze your git repository's commit log. It can help you generate daily/weekly or longer work reports.

git-commit-analytics
git-commit-analytics

Download

This is a client tool, so you need to download the program to use it. See: The Latest Release to download.

Change Log

You can look at the CHANGELOG to understand the content of each update.

Usage

Create and fill in your configuration file, and then run the program to get your work report.

Configuration

You need to create a config.json at the same folder with the program, and write the content in the following format.

{
  "lang": "en",
  "authors": ["chengpeiquan"],
  "dateRange": ["2021-12-01", "2022-01-31"],
  "repos": ["D:\\Git\\git-commit-analytics"],
  "format": {
    "git-commit-analytics": "Git Commit Analytics"
  },
  "includes": ["feat", "fix", "docs", "style", "refactor", "test", "chore"],
  "excludes": ["typo", "backup", "progress"]
}

The configuration items are described as follows:

keytypedescription
langstringSet program default language, support en (English) and zh (Simplified Chinese).
authorsstring[]Filter the author name of commits, support multiple author names, for you may have different names in different repos.
dateRange[string, string]Fill in [start date, end date], support the legal time format, and count from the start date 00:00:00 to the end date 23:59:59.
reposstring[]The Git repo folder on your computer, need to be switched to the branch you want to count.
format{ [key: string]: string }Format your folder name as the project name.
includesstring[]The commit message prefix to be included in the statistics.
excludesstring[]In the statistical results, exclude commit messages that contain these keywords.

Among them, authors / includes / excludes will be created as regular expressions to match data.

Report

The report file will be generated in markdown syntax (probably the most common format for developer?) and saved as a file in .txt format (probably the most compatible format?).

The project name will be classified as the second-level title, and 7 types of commit prefixes will be classified as the third-level title:

typedescription
featFeatures
fixBug Fixes
docsDocumentation
styleOptimized Style
refactorRefactored
testTest Cases
choreChores

You can click Commit message and Change log writing guide to learn how to standardize the git commit.