Nadav
Nadav

Reputation: 1073

Using rvm and git, can I associate a ruby version with each branch?

Is there a way to associate a specific ruby version with a specific branch ?

I would like to have:

git checkout branch-a     #ruby -v = 1.8.7
git checkout branch-b     #ruby -v = 1.9.2

Thanks

Upvotes: 4

Views: 442

Answers (2)

behe
behe

Reputation: 1368

This can be done by setting up RVM to use .rvmrc and setup automatic reloading of rvmrc files.

After installation of RVM, setup Ruby versions for each branch, eg:

rvm --rvmrc --create use ruby-1.8.7

Also add the automatic .rvmrc reloading, since .rvmrc files will only be reloaded on cd into a directory otherwise, see this gist: https://gist.github.com/2145979

Upvotes: 0

Koraktor
Koraktor

Reputation: 42923

You can have different .rvmrcs in each branch, but that requires to change the directory to become active.

git checkout whatever && cd .

Upvotes: 3

Related Questions