Skip to content

Instantly share code, notes, and snippets.

@benwaffle
Created April 11, 2020 05:52
Show Gist options
  • Save benwaffle/adc426f49e279d92501c56bb327a7006 to your computer and use it in GitHub Desktop.
Save benwaffle/adc426f49e279d92501c56bb327a7006 to your computer and use it in GitHub Desktop.
#!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]];
then
echo "Master ref received. Deploying master branch to production..."
git --work-tree=/home/deploy/server --git-dir=/home/deploy/server-bare checkout -f
else
echo "Ref $ref successfully received. Doing nothing: only the master branch may be deployed on this server."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment