开发者

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

开发者 https://www.devze.com 2023-04-13 02:39 出处:网络
Is there a way t开发者_C百科o associate a specific ruby version with a specific branch ? I would like to have:

Is there a way t开发者_C百科o 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


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

git checkout whatever && cd .


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

0

精彩评论

暂无评论...
验证码 换一张
取 消