TOTAL_CHANGES="$(git log --all --numstat --pretty="%H" | awk 'NF==3 {plus+=$1; minus+=$2} NF==1 {total++} END {printf("%d\n", plus+minus)}')"
TOTAL_LINES="$(cloc . | tail -n 2 | head -n 1 | awk '{print $NF}')"
echo "scale=2 ; $TOTAL_CHANGES / $TOTAL_LINES" | bc
echo -n ":1"
pwd
One snippet from https://gist.github.com/sephiroth74/d3ce654dcaefe1d2c4cd (modified)
How to run:
1. Clone a Git repo
2. cd into it
3. run bash ../script.sh
Output something like this:
polygot@server:~/tinkerpop$ bash ../script.sh
14.17:1/home/polygot/tinkerpop