Setting up global .gitignore file
The problem
There's a problem with how people use .gitignore
files. Many add their .idea
, .vscode
and such folders correlated to their environment of choice. While it's not such a bad thing in small private projects, it's definetely not good in larger codebases. It gets progressively harder to mantain.
But there's a solution! All the personal ignored files and folders can be stored in a global .gitignore
file for all projects. It effectively makes project's .gitignore
file contain only project-specific ignores.
Setup global .gitignore
First check if global .gitignore
already exists in your system.
$ git config --get core.excludesfile
Typically it should be in these locations:
Linux: ~/.config/git/ignore
Windows: %USERPROFILE%\.config\git\ignore
If it doesn't exist you may need to create it and tell git about it's location:
$ git config --global core.excludesfile <PATH>