Best practice: use your global .gitignoreApril 15, 2014 in Software
I was setting up a new project yesterday, and it was missing a
.powenv file I needed for Pow to work.
Most Git users understand that such files with local settings must be declared as ignorable in version control. However, it’s a common practice to add them to
.gitignore on the project level, thus polluting the project with information about files it specifically shouldn’t know about.
Well, the proper solution to local settings is the global gitignore file, located at
~/.config/git/ignore. It has the same syntax as the project gitignore file, and is applied to every project. It’s your responsibility to populate the global gitignore with all kinds of config files needed for your personal tools.
This leaves the per-project gitignore file for ignoring files relevant to the project, such as a build or temp directory.
Bonus tip: add
000000_local_env.rb to global
.gitignore and use
config/initializers/000000_local_env.rb to set up local environment variables for your Rails app.
Liked the post? Treat me to a coffee