How to create a global .gitignore file
A quick tutorial of how to add a global .gitignore file to ignore temporary files created by Visual Studio Code (VSCode) and other IDEs.
Add a global .gitignore
- Open the Terminal
touch ~/.gitignore_globalto create a global .gitignore file in the home directory
.vscode/and any other files or directories that you want to ignore and not include in project-specific
.gitignorefiles (don't forget to save!)
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.
Editor Specific Example
Visual Studio Code (and other editors) have the ability to make customizations to fit your needs; especially through extensions. I recently started using the Peacock extension to quickly distinguish between multiple VS Code instances that I may have open at one time. You can customize Peacock to change the color of your Activity Bar, Status Bar and/or the Title Bar.
I like the subtlety of only changing the Title Bar color:
This will create a
settings.json inside of a
.vscode folder. While this is applicable to your local editor, it may not be appropriate to commit to the repository (after all, your teammates may be using Atom, Sublime or Vim). Instead of adding these editor specific files to
.gitignore for every project, you can create a