Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Push to deploy GIT hook
#!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]] || [[ $ref =~ .*/develop$ ]];
then
export branch=${ref:11}
echo "$branch received. Deploying $branch branch..."
git --work-tree=/home/user/www --git-dir=/home/user/repo checkout -f $branch
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.