# .gitignore — Git Fundamentals: Commits, Branches and Collaboration

Source: https://www.skillbyai.com/en/git/git-gitignore

> Keep build output, dependencies and secrets out of Git with .gitignore patterns.

## Patterns to exclude

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

```text
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.
