Skip to content

Instantly share code, notes, and snippets.

@swcho
Created August 28, 2015 12:38
Show Gist options
  • Save swcho/1dca91d9024ed3f1236d to your computer and use it in GitHub Desktop.
Save swcho/1dca91d9024ed3f1236d to your computer and use it in GitHub Desktop.
git hook homework
#!/bin/bash
#
# Put this script as .git/hooks/post-commit
echo -e "JSON Posting post-commit Example Script\n"
LOG_JSON=$(git log -1 --pretty=format:'{\n "commit": "%H",\n "parent": "%P",\n "author": "%an <%ae>",\n "date": "%ad",\n "message": "%f"\n}' $@)
echo -e $LOG_JSON
# Use curl to post json
# http://stackoverflow.com/questions/7172784/how-to-post-json-data-with-curl-from-terminal-commandline-to-test-spring-rest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment