Skip to content

Instantly share code, notes, and snippets.

@sayanriju
Last active June 9, 2018 10:57
Show Gist options
  • Save sayanriju/6b1c77ed3f0ab4121ce2f91b3ff29dfe to your computer and use it in GitHub Desktop.
Save sayanriju/6b1c77ed3f0ab4121ce2f91b3ff29dfe to your computer and use it in GitHub Desktop.
Oneliner to count the total number of days spent on a git project
GIT_USER="${1-`git config user.name`}"
GIT_BRANCH=${2-master}
OFFSET=${3-0}
DAYS=`git log --pretty=format:"%cd %an" $GIT_BRANCH 2> /dev/null | grep -i "$GIT_USER" | awk '{print $1,$2,$3}' | uniq | wc -l`
echo "$GIT_USER spent `expr $DAYS - $OFFSET` days (tops!) on this git project ($GIT_BRANCH branch)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment