Skip to content

Instantly share code, notes, and snippets.

@sitereactor
Last active June 22, 2016 14:02
Show Gist options
  • Save sitereactor/2fc0825eed9337f4f3e2af49c948e0ff to your computer and use it in GitHub Desktop.
Save sitereactor/2fc0825eed9337f4f3e2af49c948e0ff to your computer and use it in GitHub Desktop.
post-checkout hook for changing an appsetting in web.config upon checkout
#!/bin/sh
#Git hook parameters
prevHEAD=$1
newHEAD=$2
checkoutType=$3
if [ $checkoutType -eq 1 ]
then
#Set variable with name of Branch
BRANCH=$(git rev-parse --abbrev-ref HEAD)
#Create the branch folder if it doesn't exist
mkdir -p "app_data/courier/branch"
#Remove the umbraco.config file when switching branches
rm -f app_data/umbraco.config
#Remove files in the branch folder
rm -rf app_data/courier/branch/*
#Write current branch name to the branch folder
echo '' > app_data/courier/branch/$BRANCH
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment