How to get total additions and deletions on a given branch for an given author in git

I don’t think Git has any built-in command that does this. But with the help of some other standard utilities, it can be done. Here is an example that filters Git’s log output through awk to get the summary of total insertions and deletions:

git log --author=$USER --shortstat $BRANCH | \
awk '/^ [0-9]/ { f += $1; i += $4; d += $6 } \
END { printf("%d files changed, %d insertions(+), %d deletions(-)", f, i, d) }'

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)