Skip to content

Instantly share code, notes, and snippets.

@jfollmann
Created August 13, 2021 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfollmann/5de0713c62d8a4a2381154601decd74a to your computer and use it in GitHub Desktop.
Save jfollmann/5de0713c62d8a4a2381154601decd74a to your computer and use it in GitHub Desktop.
Show git repository contribs
#!/bin/env zsh
team_total=$(git shortlog -s -n |sed 's/\t/,/g'|cut -f1 -d, |bc -l|awk '{sum+=$1}END{print sum}');
tmp_counter='/tmp/counter.txt';
tmp_user='/tmp/users.txt';
tmp_percentage='/tmp/counters_users'
# if you are running this again it make the file empty or you can rm it
rm $tmp_percentage $tmp_user $tmp_counter
git shortlog -s -n |sed 's/\t/,/g'|cut -f2 -d, >>$tmp_user;
git shortlog -s -n |sed 's/\t/,/g'|cut -f1 -d, >>$tmp_counter;
cat $tmp_counter | while read LINE; do
printf '%.2f %% \n' $(echo \($LINE/$team_total\)\*100 |bc -l ) >>$tmp_percentage
done
echo 'commits % | contributor | # of commits';paste $tmp_percentage $tmp_user $tmp_counter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment