Skip to content

Instantly share code, notes, and snippets.

@ifthenelse
Last active August 29, 2015 14:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ifthenelse/f2e1b3bff2bd2b8c110e to your computer and use it in GitHub Desktop.
Save ifthenelse/f2e1b3bff2bd2b8c110e to your computer and use it in GitHub Desktop.
A hook script to switch between parameters files when checking out different branches of the same Symfony2 repo
#!/bin/sh
#
# A hook script to switch between parameters files when checking out different branches of the same Symfony2 repo
#
# To enable this hook, rename this file to "post-checkout".
PREVIOUS_HEAD=$1
NEW_HEAD=$2
BRANCH_SWITCH=$3
if [ $BRANCH_SWITCH == "1" -a $PREVIOUS_HEAD != $NEW_HEAD ]; then
NEW_HEAD_NAME=`git rev-parse --abbrev-ref HEAD`
# Start from the repository root.
cd ./$(git rev-parse --show-cdup)
if [ $NEW_HEAD_NAME == "develop" -o $NEW_HEAD_NAME == "master" -o $NEW_HEAD_NAME == "feature/on-air-upcoming-show" ]; then
rm app/config/parameters.yml
cp app/config/parameters_guidatv.yml app/config/parameters.yml
else
rm app/config/parameters.yml
cp app/config/parameters_pilota.yml app/config/parameters.yml
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment