Skip to content

Instantly share code, notes, and snippets.

@galtenberg
Created November 17, 2010 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save galtenberg/703788 to your computer and use it in GitHub Desktop.
Save galtenberg/703788 to your computer and use it in GitHub Desktop.
Switch rvm after git checkout
#!/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
@galtenberg
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment