Global .gitignore
¶
I was today years old when I learned about the possibility of setting a global .gitignore
file.
Are you annoyed by people (mostly yourself) adding random files/patterns to repository .gitignore
file, such as editor configuration files, temporary files, or tool caches?
Say no more! You can set a global .gitignore
file that will be used everywhere.
The steps are really simple:
-
Create a
.gitignore
file, typically in your home directory: -
Open you favourite editor and add to such
.gitignore
file whatever file, folder and pattern you always want to ignore.My personal configuration looks something like this:
- This is a notebook I typically have and use for development, exploration and experimentation. I don't want to commit it to the repository.
- Settings for typos: source code spell checker
-
Make git aware of such global configuration by setting the
core.excludesFile
property to the path of the.gitignore
file you just created: -
That's it, you are set and done! 🎉
From now on, every time you run a git command the files and patterns you added to the global .gitignore
file will be ignored.
Happy coding! 🚀