Reference

.gitignore

A .gitignore is a plain-text file that tells the Git version-control system which files and folders to leave untracked — typically secrets, build output, caches, and large generated files that should not be saved into a project’s history.

Files & formatsGeneral

.gitignore

Also known as: gitignore, git ignore file, ignore file

A .gitignore is a plain-text file that tells the Git version-control system which files and folders to leave untracked — typically secrets, build output, caches, and large generated files that should not be saved into a project’s history.

  • Tells Git which files and folders to leave untracked
  • Keeps secrets, caches, and build output out of history
  • Plain text — it hides files from Git, not from your disk

What it does

When a project is tracked with Git, a .gitignore file lists patterns of files Git should skip. Each line is a rule — a filename, a wildcard like `*.log`, or a folder like `node_modules/` — and anything matching it is kept out of commits.

This keeps a repository clean: secrets such as a `.env` file, machine-specific settings, and bulky generated output stay on your computer instead of being shared with everyone who clones the project.

Why it matters

Ignoring the right files prevents two common problems: leaking credentials by committing a secrets file, and bloating the repository with caches and build artifacts that anyone can regenerate. It does not delete or hide files locally — it only stops Git from tracking them.

The file is plain text and trivially small, so it never affects storage. Editing it is how developers control what a project considers worth versioning.

Related terms

Keep reading the reference.