Skip to content

Instantly share code, notes, and snippets.

@ppsirius
Created October 19, 2017 15:47
Show Gist options
  • Select an option

  • Save ppsirius/87a43d1f7ba8a05b4db8ae897eb0fa07 to your computer and use it in GitHub Desktop.

Select an option

Save ppsirius/87a43d1f7ba8a05b4db8ae897eb0fa07 to your computer and use it in GitHub Desktop.
#!/bin/sh
#change your user name
#userName="Tomasz Milosz <[email protected]>"
userName=$(git config --get user.name)
userEmail=$(git config --get user.email)
userString=$userName" <"$userEmail">"
#Do not change anything below this line
reportFileName=AuthorsRights
month=$(date +%m)
now=$(date +"%Y-%m-%d")
#echo "Month: $month"
lastDay=31
case $month in 03|05|07|08|10|12)
lastDay=31
;;
02)
lastDay=28
;;
04|06|09|11)
lastDay=30
;;
esac
beginDay=$(date +"%Y-%m-01")
endDay=$(date +"%Y-%m-")$lastDay
echo "TODAY: $now"
echo "From: $beginDay"
echo "End : $endDay"
repositoryUrl=$(git config --get remote.origin.url)
repositoryName="${repositoryUrl##*\/}"
outputFile=$(date +"%Y%m")-$reportFileName-$USERNAME-$repositoryName".txt"
echo "git log -p --after={$beginDay} --before={$endDay} --author=$userString > $outputFile"
git log -p --after={$beginDay} --before={$endDay} --author="$userString" > $outputFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment