Skip to content

Instantly share code, notes, and snippets.

@crowjdh
Last active October 20, 2023 13:04
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 crowjdh/dc072fc362c063ea6ede0d3dcb3808c8 to your computer and use it in GitHub Desktop.
Save crowjdh/dc072fc362c063ea6ede0d3dcb3808c8 to your computer and use it in GitHub Desktop.
#!/bin/zsh
line_lengths=($(git log --pretty=format:%s | awk '{ print length($0) - 9 }'))
sum=0
line_count=${#line_lengths}
for line_length in ${line_lengths[@]}; do
sum=$((sum + line_length))
done
echo "Total $line_count commits"
echo "$((sum / line_count)) chars per commit in average"
# For debugging
# echo ${line_lengths[@]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment