Stats for your git repo
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
Written by Vinícius Gama
Related protips
10 Responses
There is git-extras
which has the git summary
command which does the same as the above with percentages.
@twolfson interesting. But I was more interested in the number of lines added and removed. Does git-extras provide me that?
Thanks
@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?
@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
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
).
The best thing that I got was the git-stats script or the gem named git-fame.
@twolfson might be a good idea. Will see if worth the effort. Thanks :)
@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
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
@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 :)