What is .gitignore?

3.1. What is .gitignore?#

A .gitignore file is a text file that tells which untracked paths to omit from normal status listings and additions. It helps prevent accidental additions; it does not stop tracking files already in the index or prevent a forced add.

Why is it Useful?

Build Artifacts

Compiled binaries, object files, executable outputs

/dist/, *.exe, *.class

Local Configuration

Machine-specific settings, API keys, credentials

.env, config.local.json, *.secret

IDE/Editor Files

Editor-specific metadata and temporary files

.vscode/, .idea/, *.swp

OS-Specific Files

System-generated files that clutter repositories

.DS_Store, Thumbs.db, *.tmp

Logs & Databases

Generated data that shouldn’t be versioned

*.log, *.sqlite, *.db