Вопрос

Is there a ruby gem to display the total commits made by a user in terminal ? And also to show the output in terms of pie chart on UI ?

Это было полезно?

Решение

Rugged gem has a way to do it.

require 'rugged'
repo = Rugged::Repository.new('git-project-dir')
walker = Rugged::Walker.new(repo)
walker.sorting(Rugged::SORT_TOPO | Rugged::SORT_REVERSE)
walker.push(repo.head.target)
walker.count { |c| c.author[:email] == "<user_email>" }

=> 52 

Without using any gem, a shell command from your git repo directory can get you the total number of commits for an user:

`git shortlog -s -n --all| grep <user> | cut -f1`
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top