Skip to content

Instantly share code, notes, and snippets.

@mrfratello
Last active January 22, 2018 22:11
Show Gist options
  • Save mrfratello/d77ac3ab89051583b17a80ada5180012 to your computer and use it in GitHub Desktop.
Save mrfratello/d77ac3ab89051583b17a80ada5180012 to your computer and use it in GitHub Desktop.
Statistics by author in SCM Git
git log --pretty=format:==%an --numstat | \
sed -r '/==.*/{s/^==//;h;D};/^$/D;s/-/0/g;s/\t[^\t]+$//;G;s/(.*)\n(.*)/\2\t\1/' \
| awk -F '\t' '{add[$1]+=$2;del[$1]+=$3} END {for (i in add) {print i,add[i],del[i]}}'
# Статистика количества коммитов у каждого автора
git shortlog -sne
# Статистика по количеству строк каждого автора в текущей (итоговой) ревизии
git ls-files -z | xargs -0n1 git blame -e | iconv -f ASCII --byte-subst='\x{%02x}' | \
cut -f2 -d' ' | ruby -n -e '$_ =~ /<(.*)>/; puts $1' | \
sort -f | uniq -c | sort -n
git ls-files -z | xargs -0n1 git blame --line-porcelain | \
sed -n 's/^author //p' | sort | uniq -c | sort -rn
# Статистика по количеству строк каждого автора с применением фильтра файлов (egrep)
git ls-files | egrep -v 'png|jpeg|jpg' | xargs -n1 git blame --line-porcelain | \
sed -n 's/^author //p' | sort | uniq -c | sort -rn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment