Skip to content

Instantly share code, notes, and snippets.

@inetfuture
Created May 14, 2013 07:14
Show Gist options
  • Save inetfuture/5574234 to your computer and use it in GitHub Desktop.
Save inetfuture/5574234 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
LOG_FILENAME = '/var/log/git-hook-post-receive.log'
from datetime import datetime
if __name__ == '__main__':
try:
from sys import stdin
prev_sha, new_sha, ref = stdin.readline().split()
commit_branch = ref.replace('refs/heads/', '')
# Do the job.
except Exception as cause:
with open(LOG_FILENAME, 'a') as log:
log.write('%s %s\n' % (datetime.now(), cause))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment