i want to see the number of removed/added line, grouped by author for a given branch in git history. there is git shortlog -s which shows me the number of commi
Since the SO question "How to count total lines changed by a specific author in a Git repository?" is not completely satisfactory, commandlinefu has alternatives (albeit not per branch):
git ls-files | while read i; do git blame $i | sed -e 's/^[^(]*(//' -e 's/^\([^[:digit:]]*\)[[:space:]]\+[[:digit:]].*/\1/'; done | sort | uniq -ic | sort -nr
It includes binary files, which is not good, so you could (to remove really random binary files):
git ls-files | grep -v "\.\(pdf\|psd\|tif\)$"
(Note: as commented by trcarden, a -x or --exclude option wouldn't work.
From git ls-files man page, git ls-files -x "*pdf" ... would only excluded untracked content, if --others or --ignored were added to the git ls-files command.)
Or:
git ls-files "*.py" "*.html" "*.css"
to only include specific file types.
Still, a "git log"-based solution should be better, like:
git log --numstat --pretty="%H" --author="Your Name" commit1..commit2 | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}'
but again, this is for one path (here 2 commits), not for all branches per branches.