Pawel Zadrozny


About confusing or poorly documented features of tools and libraries I use.

Global .gitignore file

17 Apr 2018 tools | #git

Why you should ignore files globally? - You shouldn’t but who can stop you!?

Some IDE and text editors stores cache or file index in project directory. These files are very often commited to remote repository. Way too often.

Ignore them once and for all!

Create new global .gitignore file

Filename and directory doesn’t matter.

$ vim ~/.global_gitignore

Put in all not wanted files

You can place any entry you want as you do in normal .gitignore file. But make it slim and use only for most frequent and annoying files.

For example for files which occures only on your machine.

  • You are the only MacBook user in team? - Everybody hates .DS_store!
  • Maybe you are the only one who uses PyCharm or WebStorm or whatever else JetBrains has created? - Everybody hates .idea directory!
# macOS


# temporary backup which should not be committed

# my own tools which helps me, but not fit in project

Edit [2018-09-08]:

Do not put comments in the same line as rule because git will treat them as integral part of the rule.


# comment


rule   # comment

Add the file to git config

$ git config --global core.excludesfile "~/.global_gitignore"

And voilà!