Skip to content

Instantly share code, notes, and snippets.

@olimortimer
Created December 13, 2013 15:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olimortimer/7946395 to your computer and use it in GitHub Desktop.
Save olimortimer/7946395 to your computer and use it in GitHub Desktop.
Git Hooks
#!/bin/bash
# Post checkout runs during branch switching
# Used to copy over a branch specific config.js file
branch="$(git rev-parse --abbrev-ref HEAD)"
config='mobile/assets/js/config.js'
# Check if our file exists
if [ -e $config-$branch ]
then
echo "config.js-$branch > config.js"
cp $config-$branch $config
# Else, use our live config file
else
echo "config.js-live > config.js"
cp $config-live $config
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment