You can set up a global .gitignore
file that lists files that will be ignored on all Git projects. This is the preferred way of ignoring editor artifacts, toolchain log files, OS files, and other miscellaneous crap.
git config --global core.excludesfile ~/.gitignore_global
Edit ~/.gitignore_global
and add these items below.
# Debug logs (npm, yarn)
*.log
# Editor artifacts
.*.sw[a-z]
*~
.#*
.vscode
# OS files
Thumbs.db
.DS_Store
Feel free to add more! More examples over at https://help.github.com/articles/ignoring-files/