Created
February 7, 2014 13:14
-
-
Save calvincorreli/8862423 to your computer and use it in GitHub Desktop.
Improved it a bit, so it says what it's doing, and defaults to master when there's no branch-specific setting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/zsh | |
branch_name=${$(git symbolic-ref HEAD)#refs/heads/} | |
function switch { | |
echo "Switching to database.yml.branch.${1}" | |
cp config/database.yml config/database.yml.branch.bak | |
cp config/database.yml.branch.${1} config/database.yml | |
} | |
if [ -f config/database.yml.branch.${branch_name} ]; then | |
echo "Switching to database.yml.branch.${branch_name}" | |
switch ${branch_name} | |
else | |
switch 'master' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment