#!/bin/sh
## store the arguments given to the script
read oldrev newrev refname

## Where to store the log information about the updates
LOGFILE=./post-receive.log

# The deployed directory (the running site)
DEPLOYDIR=~/public_html/

##  Record the fact that the push has been received
echo -e "Received Push Request at $( date +%F )" >> $LOGFILE
echo " - Old SHA: $oldrev New SHA: $newrev Branch Name: $refname" >> $LOGFILE

## Update the deployed copy
echo "Starting Deploy" >> $LOGFILE

echo " - Starting code update"
#GIT_WORK_TREE="$DEPLOYDIR" git pull origin >> $LOGFILE
GIT_WORK_TREE="$DEPLOYDIR" git checkout -f >> $LOGFILE
echo " - Finished code update"

echo "Finished Deploy" >> $LOGFILE
