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 ?
Asked
Active
Viewed 401 times
0
-
the equivalent git command - http://stackoverflow.com/questions/9839083/git-number-of-commits-per-author-on-all-branches – Raj Apr 15 '14 at 11:36
-
are you talking about continuous integration or just only commit count ?? – Sabyasachi Ghosh Apr 15 '14 at 11:36
-
Only commit history by a user. – Sap Apr 15 '14 at 11:49
-
I need the name of that gem, this is not about command its gem so i dont think the above stackoverflow answer will solve it. – Sap Apr 15 '14 at 11:52
1 Answers
1
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`

Raj
- 22,346
- 14
- 99
- 142
-
1I want to do it using gem, there is a rubygem to count commits and displays the content using pie chart. – Sap Apr 15 '14 at 11:48
-
Thanks for your answer, but it'll be good if you could tell any other gem's name. – Sap Apr 15 '14 at 12:39
-