What's git hook?
Git call a shell script when some actions occur.
post-receive hook will be called when receive git push (in remote server).
man githooks
post-receive
This hook is invoked by git-receive-pack on the remote repository, which happens when a git push is done on a local repository. It executes on the remote repository
once after all the refs have been updated.
How it's used
- Post to IRC
- Send Mail
- Kick UnitTest
- Kick WebHook
- etc...
Example
http://pasra.tk/ is working by some members, so I created hook to do the following things:
- Upload to http://pasra.tk/
- Notify to IRC
Codes
sayirc is
post-receive hook usage
Arguments specified by STDIN with format <old rev> <new rev> <ref>.
First set old rev and new rev to ENV using Ruby.
Then get log by git log $OLD..$NEW, and pass to sayirc.
Finally git pull at www public directory.