Modifying Rails settings without affecting your co-workers

You probably faced this kind of situation: You need to modify some configuration in your app but you don't want to commit these changes because they only affect you and your setup.

In my case the problem is assets debug. On the platform where I work every day, with the assets debug running on my Macbook air, it takes 15 seconds to load each page. Thats insane right?

The problem is that we have a lot of javascript and Sass files and my Macbook Air has a lot of trouble compiling it. That’s another issue, but i’m not focus in this today.

Today I'll teach you how to tweak your rails settings (config/) without affecting your coworkers.

Im assuming that you're using Git, because … well, we are in 2016.

The first thing you should do is open git's config file.

vim ~/.gitconfig

Now add the following line on [core] section:

You need to create this file:

touch ~/.gitignore_global

From now on you can add files to this file and they won’t be versioned by git.

Following my example, I've created a file named asset_debug_hack.rb inside my rails app at config/initializers/asset_debug_hack.rb

And of course, i've added this file in my .gitignore_global file:

And if you are curious, that's my asset_debug_hack.rb

That's very helpful if you work on a project with many people with different environments and setups.