What are the common files to ignore in Git?
Some files are not part of your source code, and you should not commit them. You list them in a file named .gitignore, one pattern per line. A line starting with # is a comment.
| Type | Examples |
|---|---|
| Dependencies | node_modules/, vendor/ |
| Logs and temporary files | *.log, *.tmp, *.cache |
| Secrets and local settings | .env, *.pem, config.local.php |
| Build output | dist/, build/, *.class |
| System files | .DS_Store, Thumbs.db |
| Editor files | .idea/, .vscode/, *.swp |
# dependencies
node_modules/
vendor/
# logs and secrets
*.log
.env
# system files
.DS_Store
Thumbs.db
Note that .gitignore does not work for files which are already tracked. See Git Ignore.
Learn more about the similar topics:
| Tutorials |
|---|
| Git Init |
| Git Status |
| Git Add |
| Git Commit |
| Git Log |
| Git Diff |
| Git Ignore (.gitignore) |