Skip to content

Instantly share code, notes, and snippets.

@Grayson
Created January 30, 2012 23:16
Show Gist options
  • Save Grayson/1707428 to your computer and use it in GitHub Desktop.
Save Grayson/1707428 to your computer and use it in GitHub Desktop.
Recent git command breakdown
#!/usr/bin/env bash
total=`cat ~/.bash_history | grep -e "^ *git" | awk '{print $1}' | sort | uniq -c | awk '{print $1}'`
oldifs=$IFS
IFS=$'\n'
for l in `cat ~/.bash_history | grep -e "^ *git" | awk '{print $2}' | sort | uniq -c`; do
count=`echo $l | awk '{print $1}'`
gitcmd=`echo $l | awk '{print $2}'`
percentage=`echo "scale=4; $count / $total * 100" | bc`
echo "git $gitcmd: $percentage%"
done
IFS=$oldifs
echo "---------------"
echo $total " git commands"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment