Common Gitignore List For React Developers

Last updated on 3 Apr, 2022

A .gitignore file in project root folder tells Git, what all files to ignore from tracking. Here is a list that can be included in .gitignore file in a normal React project.


Before working with .gitignore, ensure that you have initialized your project as a git repository using git init. Create a .gitignore file in project root and fill it with below content.


node_modules/ folder need not be pushed to Git server. It will be big and unnecessary to push it. All the package details are there in package.json file. We only need that file to be pushed to Git server to later build and run the application.

.cache/ is added to ignore temporary cache files generated by bundlers. If, for your bundler like Parcel or Webpack, the cache name is different, rename this folder name in .gitignore.

dist/ is the common name to store the output of a build process. We do not have to push the output of a build to Git. If we need to deploy the app, we take a fresh build at that time from source files.

.env contains secure environment variables and values. We do not want it to be shared with others.

coverage/ folder is generated as part of code coverage testing. That need not be there in the Git.

.vscode/ folder is created by Visual Studio Code IDE. It stores project specific settings. We do not want this folder to be pushed to Git server.

Table of Contents