Why a .gitignore matters
A .gitignore tells Git which files to never track. Without one, you risk committing node_modules (hundreds of MB), __pycache__, compiled binaries, or — worst of all — .env files and API keys. Getting the basics right from day one saves real pain.
What to ignore
- Dependencies:
node_modules/,venv/,.venv/,vendor/. - Build output:
dist/,build/,target/,__pycache__/. - Secrets:
.env,*.pem,*.key— never commit these. - OS junk:
.DS_Store,Thumbs.db.
Tip: once a file is already tracked, adding it to .gitignore won't untrack it — run git rm --cached <file> first.