Created
November 17, 2010 18:34
-
-
Save galtenberg/703788 to your computer and use it in GitHub Desktop.
Switch rvm after git checkout
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/bash | |
#Filename: .git/hooks/post-checkout | |
#Note: make sure to chmod +x post-checkout | |
CURRENT=`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\\ \1/'` | |
if [ $CURRENT = "upgrade" ]; then | |
rvm use r19 | |
else | |
rvm use system | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wayne pointed me to .rvmrc... even easier:
http://rvm.beginrescueend.com/workflow/rvmrc/#project
And he mentioned using "cd ." in the hook, to trigger loading of project rvmrc file. Though the hook may not be needed at all, with proper use of .rvmrc.