

Git script to measure contributor LOCs - beghbali
http://coderwall.com/p/4q3tgq?i=6&p=1&q=&t=git

======
zalew
and for mercurial

<http://mercurial.selenic.com/wiki/ChurnExtension>

user LOC

    
    
        $ hg churn -t users@email 
        30454 ****************************************************
    

users' changesets

    
    
        $ hg churn -c 
        user1     65 ****************************************************
        user2     41 *********************************
        user3     2 **

------
amatus
For those of us not on BSD:

    
    
        git ls-files -z | xargs -0 -n1 -E'\n' git blame --date short -wCMcp | perl -pe 's/^.*?\((.*?) +\d{4}-\d{2}-\d{2} +\d+\).*/\1/' | sort | uniq -c | sort -rn

------
prisonguard
Is LOC still a worthwhile metric to estimate developer productivity?

~~~
kelnos
Still? It never was.

~~~
prisonguard
oh, the output seems more like a leader board to me.Typically this would make
corporate heads roll with all sorts of conclusions

------
aidenn0
git blame -p is going to be easier to parse

example:

    
    
        git blame --line-porcelain |awk 'BEGIN { ORS=" " } $1=="author" {for (i=2;i<=NF;++i) print $i; printf("\n")}'|sort|uniq -c|sort -n
    

better:

    
    
        git ls-files -z|xargs -0 -n1 git blame --line-porcelain|awk '$1=="author" {auth=$2; for(i=3;i<=NF;++i) auth=auth " "$i; counts[auth]+=1} END {for(a in counts) print counts[a],a}'

------
kscaldef
Much more extensive and detailed information is provided by
<https://github.com/hoxu/gitstats>

------
esharef
Very cool -- thanks for sharing.

