Lesson 21 / 26

.gitignore

Tell Git which files to never track.

Patterns to exclude

A .gitignore file at the repo root lists patterns Git should never stage — build output, dependencies, secrets.

node_modules/
dist/
.env
*.log

Already-tracked files ignore it

.gitignore only affects untracked files. If a file is already committed, remove it from tracking with git rm --cached <file> first.