Introduction

.gitignore contains specified files to untrack. These specified files will not be included in your commits, and won’t be pushed to your repository. This is useful in preventing sensitive or useless files from being shared to others. For example, .env is .gitignore-d because it contains sensitive information.

In the mern-boilerplate repository, you’ll find a .gitignore file located in the root directory.

# dependencies
**/node_modules
**/.pnp
**/.pnp.js

# testing
**/coverage

# production
**/build

# misc
**/.DS_Store
**/.env
**/.env.local
**/.env.development.local
**/.env.test.local
**/.env.production.local

**/npm-debug.log*
**/yarn-debug.log*
**/yarn-error.log*

**/ means any parent folder.

The first block ignores dependencies. We don’t want to upload node_modules to our repository because it is very large in size and you can easily re-install them through npm. All other .gitignores are miscellaneous files that are unnecessary to be shared.