github/gitignore · Angular.gitignore
Angular .gitignore Template Explained
Why Angular.gitignore ignores dist, the .angular cache, out-tsc and coverage, and when to remove the rules that ignore lockfiles (package-lock.json, yarn.lock).
Angular.gitignore blocks build output and caches of Angular CLI projects. Most rules start with / and apply only at the workspace root.
One thing to watch is that it ignores /package-lock.json and /yarn.lock. npm recommends putting the lockfile under source control, so for applications it is common to remove these two lines.
Rules explained
| Pattern | What it ignores and why |
|---|---|
/dist//out-tsc//tmp/ | Build outputng build output, intermediate TypeScript compilation output and the temp folder. |
/.angular/.angular/ | Angular CLI cacheThe disk cache Angular CLI uses to speed up builds. Having both a root-anchored rule and an any-depth rule also blocks caches of sub-projects. |
/coverage//e2e/test-output/ | Test resultsKarma and Jest coverage and E2E test results. |
/node_modules//package-lock.json/yarn.lock | Dependencies and lockfilesnode_modules obviously should be excluded, but if lockfiles are excluded too, dependency versions can differ on every install. |
/.env/.angular-cli.json/.ng/ | Environment and settingsEnvironment variable files and old Angular CLI config files and folders. |
*.tsbuildinfonpm-debug.log*yarn-debug.log*yarn-error.log* | Logs and build infoTypeScript incremental build information and package manager logs. |
Practical notes
- After picking Angular in the generator, put
!/package-lock.jsonin Add your own rules to restore the lockfile without editing the template text. - Keep only values that are safe to publish in
src/environments/environment.ts. This file is included in the build output and delivered to the browser. - For editor settings, also use the VisualStudioCode or JetBrains template.
Original template
Angular.gitignore
# Angular specific/dist//out-tsc//tmp//coverage//e2e/test-output//.angular/.angular/# Node modules and dependency files/node_modules//package-lock.json/yarn.lock# Environment files/.env# Angular CLI and build artefacts/.angular-cli.json/.ng/# TypeScript cache*.tsbuildinfo# Logsnpm-debug.log*yarn-debug.log*yarn-error.log*
Templates from github/gitignore/Angular.gitignore @356fd7b (2026-09-11) · CC0-1.0