Skip to content

Instantly share code, notes, and snippets.

@ceronman
Created August 23, 2011 00:54
Show Gist options
  • Select an option

  • Save ceronman/1164034 to your computer and use it in GitHub Desktop.

Select an option

Save ceronman/1164034 to your computer and use it in GitHub Desktop.
Publish-bot git commit hook
#!/bin/bash
HOST=
PORT=
PUBLISH_PASSWORD=
IRC_CHANNEL=
IRC_CHANNEL_PASSWORD=
CURRENT_BRANCH=$(git branch --no-color 2>/dev/null | grep '^*' | cut -d' ' -f2)
COMMIT_MESSAGE=$(git log -n 1 --pretty=short)
IRC_MESSAGE="New commit to [$CURRENT_BRANCH]:\n$COMMIT_MESSAGE"
prefix=$PUBLISH_PASSWORD:$IRC_CHANNEL/$IRC_CHANNEL_PASSWORD:
sufix="\r\n"
echo -e "$IRC_MESSAGE" | while read line
do
echo -ne ${prefix}${line}${sufix}
done | nc $HOST $PORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment