At the office we're now starting to use Git for SCM. Since we already had a script to send a daily SVN log, we wanted to have the same for Git.
Here I show you the script we're using, hope you find it useful.
#!/bin/bash
repobase="/srv/www/api/.repositories"
recipient="youremail@example.com"
date=$(date --date="1 day ago")
date=$(echo $date | awk '{ print $1" "$2" "$3 }')
subjecttpl="Git log for $date"
repos=$(find $repobase -type d -name '.git')
for repo in $repos; do
cd $repo && cd ..
for branch in $(git branch --no-color | sed -e 's/* //') ; do
subject="[$(basename `pwd`):$branch] $subjecttpl"
echo $subject
git log --after="1 day ago" $branch | mail -e \
-a "Content-Type: text/plain;charset=utf-8" \
-a "Content-Transfer-Encoding: 8bit" \
-s "$subject" \
$recipient
done
done
If you liked this post, you can donate using Bitcoin 12jVrWkk5S6x5hEizThZwgTx59KxaDdK4C