2026-05-20 · 1 min read
gitignore templates for new repositories
Start from a stack-specific template instead of copying an old repo wholesale.
gitgitignoredevtools
Key takeaways
- Pick the template that matches your primary language/runtime, then append local paths.
- Keep secrets out of git—.env belongs in gitignore even when you parse env files in CI.
Choosing a base template
Node templates cover node_modules and build output; Python templates cover virtualenvs and __pycache__.
Regenerate when you add a new language to the monorepo—do not hand-edit hundreds of lines without review.
FAQ
Should I commit .env.example?
Yes—example files without secrets help onboarding; ignore real .env files.
Can I merge two templates?
Generate one base template, paste the second stack’s unique lines, and dedupe before commit.