Last active
September 15, 2017 12:26
-
-
Save michal-lipski/03f94703ad94871fbe47d98bb55a9782 to your computer and use it in GitHub Desktop.
This file contains 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
# avg number of commits per month in date range | |
input_start=2017-3-1 | |
input_end=2017-9-1 | |
startdate=$(date -I -d "$input_start") || exit -1 | |
enddate=$(date -I -d "$input_end") || exit -1 | |
d="$startdate" | |
sum=0 | |
count=0 | |
while [ "$d" != "$enddate" ]; do | |
part=0 | |
echo $d | |
part=`git rev-list master --count --before={$(date -I -d "$d + 1 month")} --after={$d}` | |
echo $part | |
d=$(date -I -d "$d + 1 month") | |
sum=$(($sum + $part)) | |
count=$(($count + 1)) | |
done | |
echo $(($sum / $count)) |
This file contains 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
# number of days beetwen first and last comit of a 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 |
This file contains 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
# avg number of commiters per month in date range | |
input_start=2017-3-1 | |
input_end=2017-9-1 | |
startdate=$(date -I -d "$input_start") || exit -1 | |
enddate=$(date -I -d "$input_end") || exit -1 | |
d="$startdate" | |
sum=0 | |
count=0 | |
while [ "$d" != "$enddate" ]; do | |
part=0 | |
echo $d | |
part=`git shortlog -s -n --before={$(date -I -d "$d + 1 month")} --after={$d} | wc -l` | |
echo $part | |
d=$(date -I -d "$d + 1 month") | |
sum=$(($sum + $part)) | |
count=$(($count + 1)) | |
done | |
echo $(($sum / $count)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment