Skip to content

Instantly share code, notes, and snippets.

@behe
Created March 21, 2012 10:14
Show Gist options
  • Save behe/2145979 to your computer and use it in GitHub Desktop.
Save behe/2145979 to your computer and use it in GitHub Desktop.
Reload .rvmrc after git checkout
# Put this is your .profile, .bashrc or similar to automatically reload your .rvmrc after git checkouts
git() { command git "$@" ; if [[ "$@" == *checkout* ]]; then [[ -s .rvmrc ]] && . .rvmrc; fi }
@daniel-g
Copy link

A small improvement:

git() { command git "$@"; if [[ "$1" == *checkout* ]] || [[ "$1" == *co* ]]; then [[ -s .rvmrc ]] && . .rvmrc; fi }

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