Main image
6th December
2008
written by Nick Anderson

Some projects have production code that runs off of a git cloned repository. There may be a case in which you want to notify others when that clone pulls. It is a pretty easy feat with gits post-merge hook. The post-merge hook will run after a merge (think git pull). All you have to do it create a project/.git/hooks/post-merge shell script and chmod +x it. Next time you pull successfully that script will run. Here is an example.

#!/bin/bash
TEMPLOG=$(mktemp)
echo "Sending email notification of update"
git log --reverse --no-merges --stat @{1}.. < $TEMPLOG
sendEmail -u "Production code update notification" -t recipient@domain.com < $TEMPLOG
rm $TEMPLOG
Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Reddit
  • Slashdot
  • TwitThis
Tags: , , , ,

Leave a Reply

To submit your comment, click the image below where it asks you to... Clickcha - The One-click Captcha