Created
August 28, 2015 12:38
-
-
Save swcho/1dca91d9024ed3f1236d to your computer and use it in GitHub Desktop.
git hook homework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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