How to create a global .gitignore file

Add a global .gitignore
- Open the Terminal
- Run
touch ~/.gitignore_global
to create a global .gitignore file in the home directory - Run
open ~/.gitignore_global
- Add
.vscode/
and any other files or directories that you want to ignore and not include in project-specific.gitignore
files (don’t forget to save!) - Run
git config --global core.excludesfile ~/.gitignore_global
That’s it! Using .gitignore_global
will let you customize your editor without having to edit and commit changes to the .gitignore
file for every single project.