ypdvha
Last Updated: February 25, 2016
·
1.898K
· viniciusgama
02970a5c2b23a211a5e2b3a566d19615

Stats for your git repo

git
IFS=''
for author in $(git log --all --format="%an" | sort -u)
do
  git log --author="$author" --pretty=tformat: --numstat | \
  grep -v node_modules |  \
  awk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END \
  { printf "%s +++ / %s --- / %s ++- \n",add,subs,loc }' -
done
Say Thanks
Respond

10 Responses
Add your response

5834
15927fc52919e9223adc7ed99e125d4d

There is git-extras which has the git summary command which does the same as the above with percentages.

https://github.com/visionmedia/git-extras

over 1 year ago ·
5844
02970a5c2b23a211a5e2b3a566d19615

@twolfson interesting. But I was more interested in the number of lines added and removed. Does git-extras provide me that?
Thanks

over 1 year ago ·
5861
15927fc52919e9223adc7ed99e125d4d

@viniciusgama I do not think it does. I am semi-clear and semi-unclear of the purpose of your protip. Can you provide more of an explanation?

over 1 year ago ·
5886
02970a5c2b23a211a5e2b3a566d19615

@twolfson I was just trying to get the top contributors on a git repo. Similar to what github does in his graph page.

example: https://github.com/viniciusgama/strider/contributors

over 1 year ago ·
5903
15927fc52919e9223adc7ed99e125d4d

Ah, okay. I don't think they have a method for that. You might want to consider create a pull request for that. It would be nice to see that as a flag on git summary (e.g. git summary --lines).

over 1 year ago ·
5918
736212 10200976756252420 836055407 o

The best thing that I got was the git-stats script or the gem named git-fame.

over 1 year ago ·
5921
02970a5c2b23a211a5e2b3a566d19615

@twolfson might be a good idea. Will see if worth the effort. Thanks :)

over 1 year ago ·
5922
02970a5c2b23a211a5e2b3a566d19615

@emgiezet seems like git-stats have what I want but it was kind of hard to use and I gave up. The git-fame seems pretty nice and maybe I'll try to write a port for it as a npm package. Will be a good opportunity to study :)

Thanks

over 1 year ago ·
6090
7f9d997af5eafade31ebd807bce68f24

I had to write something equivalent for a project which didn't use git author because we were pairing- we just used a special format of commit messages. https://github.com/compwron/pairSee

over 1 year ago ·
6105
02970a5c2b23a211a5e2b3a566d19615

@lindaTW, that would be my next step. In my current project we work in pairs too and we use a special format for the commit messages.
Thanks for sharing :)

over 1 year ago ·
Filed Under