Skip to content

Instantly share code, notes, and snippets.

@rufhausen
Created March 8, 2013 04:02
Show Gist options
  • Save rufhausen/5114133 to your computer and use it in GitHub Desktop.
Save rufhausen/5114133 to your computer and use it in GitHub Desktop.
Git post-receive script used by a remote repository to checkout the latest version of a web app to the web application root following a push from the local repository. Includes additional commands for the Laravel PHP framework
#!/bin/sh
WEBROOT=/var/www/vhosts/[application folder]
GIT_WORK_TREE=$WEBROOT git checkout -f
#/usr/bin/git log -1 --pretty=format:'%h' --abbrev-commit > $WEBROOT/version.txt
cd $WEBROOT
rm -f storage/cache/*
echo 'cache cleared\n'
rm -f storage/views/*
echo 'views cleared\n'
php artisan migrate --env=test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment