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_globalEdit ~/.gitignore_global and add these items below.
# Debug logs (npm, yarn)
*.log
# Editor artifacts
.*.sw[a-z]
*~
.#*
.vscode
# OS files
Thumbs.db
.DS_StoreFeel free to add more! More examples over at https://help.github.com/articles/ignoring-files/