Skip to content

Instantly share code, notes, and snippets.

View rufhausen's full-sized avatar

Gary Taylor rufhausen

View GitHub Profile
@rufhausen
rufhausen / gist:5114133
Created March 8, 2013 04:02
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/*
@rufhausen
rufhausen / gist:5114025
Last active December 14, 2015 16:19
This is my attempt to use Git to push to a remote server AND update a version.txt file that is then included and displayed in a web app with the most recent repository tag (1.0, etc.) and the abbreviated commit hash (i.e., the output of "git describe". Naming this file "push", you execute it while passing in the name of the git remote ("./push t…
#!/bin/bash
VERSION_FILE=version.txt
GIT_PATH=/usr/local/git/bin/git
REMOTE_PATH=[full remote path to application root]/$VERSION_FILE
LOCAL_PATH=[full local path to application root]/$VERSION_FILE
TEST_SERVER=[test ip/domain]
PROD_SERVER=[prod ip/domain]
if [ -z "$1" ]; then