I would like to see statistics telling me which authors have contributed how many lines within a given directory.
git-extras and some other similar tools exist, but I am having trouble figuring out if I can use them (or anything else) to restrict my statistics to a given directory.
Any ideas?
You can use a short script:
#!/bin/bash
git shortlog -s -- $1 | cut -c8- | while read i
do
git log --author="$i" --pretty=tformat: --numstat -- $1 \
| awk -v name="$i" '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "%s: added lines: %s removed lines: %s total lines: %s\n", name, add, subs, loc }'
done
call it loc.sh and then run: loc.sh [directory/file]
The output would be something like this:
Name1: added lines: 10757 removed lines: 49 total lines: 10708
Nmae2: added lines: 1193 removed lines: 94255 total lines: -93062
see more here and here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With