Resident Demigod

Veezus Kreist

Divine missives

Ignoring machine-specific changes to .rvmrc

August 11, 2010 15:43

At Hashrocket, we use RVM to manage our rubies and gemsets on client projects. We typically specify the version of ruby that’s in production in our .rvmrc, like so:

rvm_gemset_create_on_use_flag=1
rvm 1.8.7-p249@vurl

However, sometimes a machine will have a problem with an installation of ruby, and so we’ll use a different version on that machine. Yeah, the correct solution is to fix the damn ruby, but we solved the problem today by flexing some little-used git fu… updating the index to ignore local changes to a file.

So, our `git status` shows us:

# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   .rvmrc
#
no changes added to commit (use "git add" and/or "git commit -a")

Now let’s instruct git to assume our .rvmrc is unchanged:

git update-index --assume-unchanged .rvmrc

And now our `git status` looks much better:

# On branch master
nothing to commit (working directory clean)
blog comments powered by Disqus