Do you remember how much times during you developer career you forgot to add some IDE files to .gitignore? There is a feature that could help you to get rid of creating .gitignore with common excludes for every new project. And this feature is called global .gitignore file.
Adding global .gitignore file on Mac
In order to start using it, go through these steps:
- Open Terminal.
touch ~/.gitignore_global- this will create global .gitignore file in your home directory.
- Add some values that you would like to always ignore. For example, you could use this file.
git config --global core.excludesfile ~/.gitignore_global. According to this page at git-scm.com this command will make all the patterns from
~/.gitignore_globalignored in all situations.
Done. Now no need to worry about creating common ignore sections for every project your start.