Skip to content

Instantly share code, notes, and snippets.

@ludofleury
Last active July 22, 2019 19:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ludofleury/2197b4fb46a521bec084 to your computer and use it in GitHub Desktop.
Save ludofleury/2197b4fb46a521bec084 to your computer and use it in GitHub Desktop.
#!/bin/bash
# use newline as separator
IFS=$'\n'
for author in $(git log --all --format='%cN' | sort -u); do
echo $author;
git log --all --author="$author" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "++ %s\n-- %s\n= %s\n", add, subs, loc }' -
done
# git config --global alias.impact '!sh git-impact.sh'
@ludofleury
Copy link
Author

ludofleury commented Sep 4, 2015

Add this to your bin directory where git is located (/usr/bin)
or alias it in git as shown
Then run git impact

to display stats like

Firstname Lastname
+ 8247
- 658
= 7589

@ludofleury
Copy link
Author

zsh formatted

#!/bin/bash

# use newline as separator
IFS=$'\n'

for author in $(git log --all --format='%cN' | sort -u); do
    echo "\033[1;37m$author\033[0m"; 
    git log --all --author="$author" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "\033[0;32m++ %s\n\033[0;31m-- %s\n\033[0m= %s\n", add, subs, loc }' -
done

# git config --global alias.impact '!sh git-impact.sh'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment