Created
September 11, 2012 10:45
-
-
Save deanrather/3697539 to your computer and use it in GitHub Desktop.
example git post-receive hook determining which branch was pushed
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 | |
echo "determining branch" | |
if ! [ -t 0 ]; then | |
read -a ref | |
fi | |
IFS='/' read -ra REF <<< "${ref[2]}" | |
branch="${REF[2]}" | |
if [ "master" == "$branch" ]; then | |
echo 'master was pushed' | |
fi | |
if [ "staging" == "$branch" ]; then | |
echo 'staging was pushed' | |
fi | |
echo "done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks to http://dylansserver.com/note/git_post-receive_hook