Last active
August 29, 2015 14:21
-
-
Save achristodoulou/d431123a47ffdf835006 to your computer and use it in GitHub Desktop.
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
| #!/bin/bash | |
| if [ "$1" == "-h" ] ; then | |
| echo "Send a friendly weekly report of git commits to the specified email" | |
| echo "Usage: `basename $0` [-h] recepient_email email_subject" | |
| exit 0 | |
| fi | |
| if ! git ls-files >& /dev/null; then | |
| echo "You can only run this command inside a git repository!" | |
| exit 0 | |
| fi | |
| to="$1"; | |
| subject="$2"; | |
| if [ -z "$to" ]; then | |
| echo "Recepient email address is required!" | |
| exit 0 | |
| fi | |
| if [ -z "$subject" ]; then | |
| echo "Subject is required!" | |
| exit 0 | |
| fi | |
| ( | |
| message=`git log --pretty=format:"<span style='color: blue;'>%an</span> %s <span style='color: grey;font-size: 9px'>%cd %H</span><br />" --since=1.weeks --decorate | sort`; | |
| echo "To: ${to}"; | |
| echo "Subject: ${subject}"; | |
| echo "Content-Type: text/html"; | |
| echo "MIME-Version: 1.0"; | |
| echo ""; | |
| echo "${message}"; | |
| ) | sendmail -t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment