Skip to content

Instantly share code, notes, and snippets.

@jandudulski
Created November 2, 2011 13:11
Show Gist options
  • Save jandudulski/1333581 to your computer and use it in GitHub Desktop.
Save jandudulski/1333581 to your computer and use it in GitHub Desktop.
post-update hook which deploy on server when pushed changes to live branch
#!/bin/sh
branch=$(git rev-parse --symbolic --abbrev-ref $1)
if [ $branch == "live" ]
then
echo
echo "**** Pulling changes into live server ****"
echo
cd /var/www/www.example.com || exit
unset GIT_DIR
git pull origin live
echo
echo "**** Reloading Apache ****"
echo
sudo /etc/init.d/apache2 reload
exec git-update-server-info
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment