Last active
June 9, 2018 10:57
-
-
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
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
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