-
-
Save sergeysova/8b68f8e20ae6e771b4d4 to your computer and use it in GitHub Desktop.
Remind yourself of what you did over the past day and week by reading a summary of all of your git commits.
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
0 22 * * 1,2,3,4,5 sh /path/to/git_changes.sh # Sends 5 PM EST if server time is UTC | |
0 21 * * 5 sh /path/to/git_changes.sh -w # Sends Friday @ 4PM EST if server time is UTC |
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
#!/usr/bin/env bash | |
PROJECTS_DIR=/path/to/projects | |
[email protected] | |
if [ "$1" = "-w" ]; then | |
mailing="weekly" | |
since="1.week" | |
format="iso" | |
else | |
mailing="daily" | |
since="1.day" | |
format="relative" | |
fi | |
output="" | |
for git in $(find $PROJECTS_DIR/ -maxdepth 2 -name "*.git"); do | |
gitdir=$(dirname "$git"); | |
cd $gitdir | |
changes=$(git --no-pager log --date=$format --pretty=format:"%cd: %s" --decorate=short --since=$since); | |
if [ "$changes" ]; then | |
output="$output\n$gitdir:\n$changes\n\n" | |
fi | |
done | |
if [ "$output" ]; then | |
if [ "$mailing" = "weekly" ]; then | |
echo -e "$output" | mail -s "Weekly git commits update for week ending $(date +'%b %d')" $RECIPIENT | |
else | |
echo -e "$output" | mail -s "git commits for $(date +'%A, %b %d')" $RECIPIENT | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment