Skip to content

Instantly share code, notes, and snippets.

@ludofleury

ludofleury/git-impact.sh

Last active Jul 22, 2019
Embed
What would you like to do?
#!/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

This comment has been minimized.

Copy link
Owner Author

@ludofleury 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

This comment has been minimized.

Copy link
Owner Author

@ludofleury ludofleury commented Jul 22, 2019

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
You can’t perform that action at this time.