Few times you might have ended up pushing node_modules
to git and looked silly in front of your teammates.
It might be hard to remember what to push to git and what not to. In this article, let's see which files you can add to .gitignore
file, so that git ignores them and does not pushes it.
Below is a list which you can add to the .gitignore
file:
1node_modules/2.vscode/3coverage/4dist/5build/6.cache/7.next/
node_modules/
- Node modules is where all your packages are downloaded and installed, it is huge in size and you definitely do not want to push it to git.
.vscode/
- This directory is created by VS Code. It will change from one user to another.
coverage/
- If you have unit tests in your code, then when you test for coverage, it generates this folder. You need not push this to git. Your colleagues can run the coverage scripts to generate these files.
dist/
and build/
- This is where the files generated during build are stored. These files may change from system to system.
.cache
and .next/
- These files are temporary files created by bundlers, you should not push it to git. If you are using Next.js project, then it creates these files in .next/
folder.
Do follow me on twitter where I post developer insights more often!