Skip to content

Instantly share code, notes, and snippets.

@michal-lipski
Created September 15, 2017 12:30
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 michal-lipski/c5b33f7d5db81fd87a8a0f9a6b1a80f8 to your computer and use it in GitHub Desktop.
Save michal-lipski/c5b33f7d5db81fd87a8a0f9a6b1a80f8 to your computer and use it in GitHub Desktop.
Number of days in git project per user.
# number of days beetween first and last commit by user
mapfile -t authors < <( git log --pretty=format:%an | sort | uniq )
echo "Number of authors:" ${#authors[@]}
for author in "${authors[@]}"
do
lastCommitDate=`git log --pretty=format:%at --author="$author" | sed -n 1p`
firstCommitDate=`git log --pretty=format:%at --author="$author" | tail -1`
if [ ! -z "$lastCommitDate" ];
then
daysInProject=$((($lastCommitDate - $firstCommitDate)/60/60/24))
echo $author" "$daysInProject
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment