Last active
August 5, 2021 09:05
-
-
Save kiselev-nikolay/0c472eed37c85eeabe227f47fe3af5ac to your computer and use it in GitHub Desktop.
Get git stat by lines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/fish | |
function git_stat | |
for i in (git log --format='%aN' | sort -u) | |
printf "STAT %s%s%s\n" (set_color red) "$i" (set_color normal) | |
git log --author="$i" --pretty=tformat: --numstat | awk '{inserted+=$1; deleted+=$2; delta+=$1-$2; ratio=deleted/inserted} END {printf "STAT Commit stats:\nSTAT - Lines added (total).... %s\nSTAT - Lines deleted (total).. %s\nSTAT - Total lines (delta).... %s\nSTAT - Add./Del. ratio (1:n).. 1 : %s\n", inserted, deleted, delta, ratio }' - | |
echo | |
end | |
end | |
git_stat 2>&1 | grep "STAT" | less -R |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: