Created
January 15, 2009 11:55
-
-
Save FiXato/47377 to your computer and use it in GitHub Desktop.
Switch between github branches and change the rails database.yml
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/sh | |
# Usage: switch2branch branchname | |
# Easily switch between branches and their databases for Rails projects. | |
# Checks out given branch and copies the branch's database.yml to the active database.yml | |
# Outputs a small list of databases being used. | |
# Make sure you have set up your branch's database.yml in #{RAILS_ROOT}/config/database.branch.#{branchname}.yml | |
git checkout $1 && cp ./config/database.branch.$1.yml ./config/database.yml | |
echo Using: | |
egrep "^\\w+:|database:" config/database.yml | sed s/database:/\ / |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment