gitignore in Git
From the Git cheat sheet ยท Getting Started ยท verified Jul 2026
.gitignore
Tell Git which files and directories to ignore
bash
# Create .gitignore in repo root
# Common patterns:
node_modules/
.env
.env.local
dist/
build/
*.log
.DS_Store
.vscode/
.idea/
# Stop tracking a file that's already committed
git rm --cached <file>
git rm -r --cached <directory>๐ก .gitignore only affects untracked files
โ ๏ธ Already-tracked files keep being tracked โ use git rm --cached to stop
โ
Use a global ignore for OS/editor junk (.DS_Store, .vscode/)
๐ Commit .gitignore so the whole team shares it