Skip to content

Instantly share code, notes, and snippets.

@t2k t2k/post-update

Created May 6, 2015
Embed
What would you like to do?
my post-update (hook) How to deploy a website via a shared repo.
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
#
# ie: git push default_test MyNewBranch
# $1 would equal refs/heads/MyNewBranch
# and $branch = MyNewBranch
branch=$(git rev-parse --symbolic --abbrev-ref $1) || "master"
echo pushed to remote: default_test branch: $branch
# change to working directory for our TEST/DEVELOPMENT SITE
cd /cygdrive/c/inetpub/wwwroot/default_test || exit
# remember we are
# executing from the post-update hook of the --bare repo
# need to unset the ENV to pull the --bare into the working directory
unset GIT_DIR
echo "#### Pulling changes into default_test working directory ####"
# must define a remote as hub that points to the --bare repo
# ie git remote add hub ~/test_hub.git
# $branch is from line 11 above
# http://stackoverflow.com/questions/7331519/find-git-branch-name-in-post-update-hook
git pull hub $branch
echo DONE: pulled $branch into /inetpub/wwwroot/default_test
exec git update-server-info
@xjackk

This comment has been minimized.

Copy link

xjackk commented May 6, 2015

+1, someone hire this guy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.