Git is a source control system that is used for tracking and merging changes in code. If there’s files we want to push into source code for some reason we can use the .gitignore syntax.
Here’s a simple gitignore file that I start with most NodeJS projects. We definitely don’t want to include node_modules, build directories or npm-debug.logs as these will frequently change.
There used be a belief that we should check in node_modules but this isn’t necessary because of the package.json and package locking that can pin everything to specific versions.