Skip to content

Instantly share code, notes, and snippets.

@alexbonhomme
Created July 14, 2016 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexbonhomme/4f7e7c80284c87bf7528a9d4fc80f96c to your computer and use it in GitHub Desktop.
Save alexbonhomme/4f7e7c80284c87bf7528a9d4fc80f96c to your computer and use it in GitHub Desktop.
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