Every time we work in an existing/new project IDE and operating system keep creating multiple files and we need to handle them in every. By using global git ignore file we can globally ignore this and save some time.

Add the global config file in Mac or Linux:

  1. Fire your terminal
  2. Run touch ~/.gitignore_global - this will create global .gitignore file in your home directory.
  3. Add some values that you would like to always ignore. 
  4. Run git config –global core.excludesfile ~/.gitignore_global. According to this page at git-scm.com this command will make all the patterns from ~/.gitignore_global ignored in all situations.

Done !!