Skip to content

Instantly share code, notes, and snippets.

@deanrather
Created September 11, 2012 10:45
Show Gist options
  • Save deanrather/3697539 to your computer and use it in GitHub Desktop.
Save deanrather/3697539 to your computer and use it in GitHub Desktop.
example git post-receive hook determining which branch was pushed
#!/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"
@deanrather
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment