A small hook meant to be installed on a remote git repo.
The hook is a post update hook and sould be run by the remote repo each time somebody successfully pushes to the repo.
It will create a directory called master and check out the remote repo into this and make sure to pull changes from the remote repo on every commit.
Essentially you get a disconnected non bare version of the remote bare repo. You should never change the files. If you do the hook will fail. If so just delete the entire master directory that was created. A new directory will be created again on next commit.
Place the following the the hooks directory and call the file post-update
echo "Running post commit JACK hook"
if [ ! -d $(pwd)/master/.git ]; then
echo “creating checkout master copy”
git clone “$(pwd)” $(pwd)/master
fi
echo “updating checked out master”
git –git-dir=”$(pwd)/master/.git” –work-tree=”$(pwd)/master” pull origin