This post exists for one reason, everyone should have a .gitignore if they are using GitHub.
I tell you why and what it is here: https://amyabelsql.com/2026/05/24/git-it-right-the-first-time-with-gitignore/
This is my .gitignore list. It covers the most common offenders in almost every project.
Start here then remove what does not apply. Keep source control focused on source code and keep it clean.
If something was already committed by mistake:
git rm --cached filename
Then add it to .gitignore.
Here is a my list:
# =================================================
# Core (Everyone)
#
# These files are generated or machine‑specific.
# They add noise to diffs and nothing else.
# =================================================
# OS junk
.DS_Store
Thumbs.db
# Logs created at runtime
*.log
# Temporary editor and system files
*.tmp
*.temp
*.swp
*.swo
# =================================================
# Secrets and Credentials (Non‑Negotiable)
#
# If it contains a password, token, or key,
# it does not belong in Git.
#
# Accidentally committing secrets is one of the
# fastest ways to create a security incident.
# Do not rely on memory. Let .gitignore enforce it.
# =================================================
# Environment variables
.env
.env.*
# Keys and certs
*.pem
*.key
*.crt
*.pfx
# Credentials
credentials.json
secrets.json
# =================================================
# IDE and Editor Files
#
# Editor settings are personal.
# Versioning them causes churn and conflicts.
# =================================================
# VS Code
.vscode/
# IntelliJ / JetBrains
.idea/
*.iml
# Eclipse
.project
.classpath
.settings/
# =================================================
# Build Artifacts (Language‑Agnostic)
#
# If your build can generate it,
# Git does not need to store it.
# =================================================
# Build output
build/
dist/
out/
target/
# Coverage
coverage/
*.lcov
# =================================================
# Dependency Directories
#
# You can always reinstall dependencies.
# You cannot easily undo a bloated repo history.
# =================================================
# Node
node_modules/
# Python
__pycache__/
*.pyc
.venv/
venv/
# Java
*.class
# =================================================
# Containers and Infrastructure
#
# Terraform state files especially should never be committed.
# They often contain sensitive infrastructure details.
# =================================================
# Docker
.env.docker
docker-compose.override.yml
# Terraform
.terraform/
*.tfstate
*.tfstate.backup
# =================================================
# Database and Local Data
# Local data is environment‑specific, often large, and frequently sensitive.
# Keep it out of source control.
# =================================================
# Local databases
*.db
*.sqlite
*.sqlite3
# Dumps
*.dump
*.sql
# =================================================
# Test and Debug Output
# These are artifacts of running code,
# not the code itself.
# =================================================
# Test output
test-results/
reports/
# Debug
debug/
If you have some that you think I should add to my list please comment or reach out. I love to learn from others.
I have more commit tricks coming up. Stay tuned for more content.
Leave a Reply