Node .gitignore Template
The full, current Node .gitignore template — copy it as-is, or head to the .gitignore Generator to merge it with other stacks into one file.
Template
# Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* lerna-debug.log* # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json # Runtime data pids *.pid *.seed *.pid.lock # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage *.lcov # nyc test coverage .nyc_output # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) .grunt # Bower dependency directory (https://bower.io/) bower_components # node-waf configuration .lock-wscript # Compiled binary addons (https://nodejs.org/api/addons.html) build/Release # Dependency directories node_modules/ jspm_packages/ # Snowpack dependency directory (https://snowpack.dev/) web_modules/ # TypeScript cache *.tsbuildinfo # Optional npm cache directory .npm # Optional eslint cache .eslintcache # Optional stylelint cache .stylelintcache # Optional REPL history .node_repl_history # Output of 'npm pack' *.tgz # Yarn Integrity file .yarn-integrity # dotenv environment variable files .env .env.* !.env.example # parcel-bundler cache (https://parceljs.org/) .cache .parcel-cache # Next.js build output .next out # Nuxt.js build / generate output .nuxt dist .output # Gatsby files .cache/ # Comment in the public line in if your project uses Gatsby and not Next.js # https://nextjs.org/blog/next-9-1#public-directory-support # public # vuepress build output .vuepress/dist # vuepress v2.x temp directory .temp # Sveltekit cache directory .svelte-kit/ # vitepress build output **/.vitepress/dist # vitepress cache directory **/.vitepress/cache # Docusaurus cache and generated files .docusaurus # Serverless directories .serverless/ # FuseBox cache .fusebox/ # DynamoDB Local files .dynamodb/ # Firebase cache directory .firebase/ # TernJS port file .tern-port # Stores VSCode versions used for testing VSCode extensions .vscode-test # pnpm .pnpm-store # yarn v3 .pnp.* .yarn/* !.yarn/patches !.yarn/plugins !.yarn/releases !.yarn/sdks !.yarn/versions # Vite files vite.config.js.timestamp-* vite.config.ts.timestamp-* .vite/
What each entry does
Why every line in this template is excluded, not just what it matches.
| Entry | Why it's excluded |
|---|---|
| logs | A directory of runtime log files — same reasoning as *.log: regenerated, machine-specific, unbounded. |
| *.log | Runtime log output — grows unbounded, is different on every machine/run, and has no value in version control. |
| npm-debug.log* | Files matching npm-debug.log* — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| yarn-debug.log* | Files matching yarn-debug.log* — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| yarn-error.log* | Files matching yarn-error.log* — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| lerna-debug.log* | Files matching lerna-debug.log* — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | Files matching report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| pids | A generated/local directory (pids) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| *.pid | A process-ID file a running dev server writes — pure runtime state, meaningless once the process exits. |
| *.seed | Files matching *.seed — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| *.pid.lock | Files matching *.pid.lock — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| lib-cov | A generated/local directory (lib-cov) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| coverage | Test-coverage report output — regenerated by the test runner, not something to diff in git. |
| *.lcov | A test-coverage report in lcov format — generated output, not source. |
| .nyc_output | Istanbul/nyc's raw coverage data before it's turned into a report — intermediate, regenerable. |
| .grunt | Files matching .grunt — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| bower_components | A generated/local directory (bower_components) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| .lock-wscript | Files matching .lock-wscript — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| build/Release | A generated/local directory (build/Release) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| node_modules/ | Installed npm/yarn/pnpm packages — fully reproducible from package.json and the lockfile, and can run into the tens of thousands of files. |
| jspm_packages/ | A generated/local directory (jspm_packages) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| web_modules/ | A generated/local directory (web_modules) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| *.tsbuildinfo | Files matching *.tsbuildinfo — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| .npm | Files matching .npm — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| .eslintcache | Files matching .eslintcache — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| .stylelintcache | Files matching .stylelintcache — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| .node_repl_history | Files matching .node_repl_history — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| *.tgz | Files matching *.tgz — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| .yarn-integrity | Files matching .yarn-integrity — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| .env | Local environment variables — routinely holds real secrets (API keys, DB passwords), so it must never be committed. Commit a .env.example instead. |
| .env.* | Files matching .env.* — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| !.env.example | Re-includes .env.example — carves out an exception to a broader exclusion pattern above it. |
| .cache | Files matching .cache — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| .parcel-cache | Files matching .parcel-cache — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| .next | Files matching .next — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| out | A generated/local directory (out) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| .nuxt | Files matching .nuxt — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| dist | The bundled, production-ready output a build step produces — regenerate it with the build command rather than committing it. |
| .output | Files matching .output — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| .cache/ | A generated/local directory (.cache) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| .vuepress/dist | Excludes .vuepress/dist — generated or machine-specific for this stack, not something to track in version control. |
| .temp | Files matching .temp — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| .svelte-kit/ | A generated/local directory (.svelte-kit) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| **/.vitepress/dist | Excludes **/.vitepress/dist — generated or machine-specific for this stack, not something to track in version control. |
| **/.vitepress/cache | Excludes **/.vitepress/cache — generated or machine-specific for this stack, not something to track in version control. |
| .docusaurus | Files matching .docusaurus — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| .serverless/ | A generated/local directory (.serverless) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| .fusebox/ | A generated/local directory (.fusebox) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| .dynamodb/ | A generated/local directory (.dynamodb) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| .firebase/ | A generated/local directory (.firebase) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| .tern-port | Files matching .tern-port — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| .vscode-test | Files matching .vscode-test — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| .pnpm-store | Files matching .pnpm-store — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| .pnp.* | Files matching .pnp.* — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| .yarn/* | Excludes .yarn/* — generated or machine-specific for this stack, not something to track in version control. |
| !.yarn/patches | Re-includes .yarn/patches — carves out an exception to a broader exclusion pattern above it. |
| !.yarn/plugins | Re-includes .yarn/plugins — carves out an exception to a broader exclusion pattern above it. |
| !.yarn/releases | Re-includes .yarn/releases — carves out an exception to a broader exclusion pattern above it. |
| !.yarn/sdks | Re-includes .yarn/sdks — carves out an exception to a broader exclusion pattern above it. |
| !.yarn/versions | Re-includes .yarn/versions — carves out an exception to a broader exclusion pattern above it. |
| vite.config.js.timestamp-* | Files matching vite.config.js.timestamp-* — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| vite.config.ts.timestamp-* | Files matching vite.config.ts.timestamp-* — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| .vite/ | A generated/local directory (.vite) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |