#!/bin/bash
TARGET="/opt/game/remote"
GIT_DIR="/opt/game/remote.git"
BRANCH="master"

while read oldrev newrev ref
do
    if [ "$ref" = "refs/heads/$BRANCH" ]; then
        echo "Deploying $BRANCH to $TARGET ..."
        git --work-tree=$TARGET --git-dir=$GIT_DIR checkout -f $BRANCH
        echo "Deploy completed."
    fi
done
