git_stats统计工具:统计小伙伴们的git代码提交

Code 代码
/ git
9月 28, 2018 ~

工具选型

git统计工具可选并不多,找了许久,在找到以下几个:

经过一番比较,最终选择了git_stats,主要有以下几个好处:

  • 相对较新,输出样式最讨人喜爱;
  • 功能齐全,可与gitstats一拼;

为方便与CI集成,打成docker镜像 goodideal/docker-git-stats:latest,维护地址为:https://github.com/goodideal/git_stats

git_stats使用方法

git_stats使用方法非常简单,摘出帮助供参考:

$ git_stats help generate
Usage:
  git_stats generate

Options:
  p, [--path=PATH]                          # Path to repository from which statistics should be generated.
                                            # Default: .
  o, [--out-path=OUT_PATH]                  # Output path where statistics should be written.
                                            # Default: ./git_stats
  l, [--language=LANGUAGE]                  # Language of written statistics.
                                            # Default: en
  f, [--first-commit-sha=FIRST_COMMIT_SHA]  # Commit from where statistics should start.
  t, [--last-commit-sha=LAST_COMMIT_SHA]    # Commit where statistics should stop.
                                            # Default: HEAD
  s, [--silent], [--no-silent]              # Silent mode. Don't output anything.
  d, [--tree=TREE]                          # Tree where statistics should be generated.
                                            # Default: .
  c, [--comment-string=COMMENT_STRING]      # The string which is used for comments.
                                            # Default: //

Generates the statistics of a repository

应打包成了docker镜像,运行命令如下:

$ docker run --rm -v GIT_PATH:/git:ro -v OUTPUT_PATH:/gitstats goodideal/docker-git-stats:latest

其中挂载了2个目录:

  • GIT_PATH git目录路径
  • OUTPUT_PATH 统计输出路径

版本控制

Version Action Time
1.0 Init 2018-09-28

标签

Jerry

大道至简,行者无疆。