23
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Gitの貢献度?を計るワンライナーたち

Posted at

これは何?

GitリポジトリのAuthor数、追加行数、削除行数を算出するワンライナーをメモしたもの。

Author一覧

git shortlog -se | awk -F'\t' '{print $2,$3}'

リポジトリ全体の削除・追加行数

git log --numstat --pretty="%H"  | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}'

コミット数

git log --oneline --no-merges | wc -l

追加行数

git log --oneline --shortstat --no-merges | grep files | cut -d" " -f5 | awk 'BEGIN {sum=0} {sum+=$1} END {print sum}'

削除行数

git log --oneline --shortstat --no-merges | grep files | cut -d" " -f7 | awk 'BEGIN {sum=0} {sum+=$1} END {print sum}'

定番オプション

それぞれ、期間やAuthorを区切るときはオプションを付記する。

--since=yyyy-mm-dd --until=yyyy-mm-dd --author='xxxxx'
23
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?