.gitignore tells Git which files to skip. Patterns:
node_modules/ — ignore directory
*.log — ignore by extension
!important.log — exception (do track this)
.env* — all env files
build/ — build output
Already-tracked files need git rm --cached <file> to untrack.
Use git check-ignore -v <file> to debug which rule matches.