Definitive authority on template creation and maintenance. Every template in this repository follows the standards defined here. If there is a conflict between this document and any other, this document governs.
All standards derive from four principles. When in doubt, return to these.
Security patterns are never optional. Framework templates embed them in the first section. Language templates require common/security.gitignore — never skip it. The most damaging Git mistakes involve committed credentials; templates must prevent this by default.
A template is either self-contained (framework — everything in one file) or modular (language — designed to combine). Templates that try to be both create confusion and duplicates. The boundary is bright and enforced.
Users should open any template and immediately understand its layout. The header, metadata, sections, and footer follow a consistent visual language. Uniformity makes templates scannable and predictable.
Every pattern costs: maintenance, cognitive load, risk of over-matching. Default to exclusion. A pattern earns its place only when committed instances would cause real problems — broken builds, leaked credentials, bloated repositories.
Every template has five structural zones.
┌─────────────────────────────────────┐
│ ZONE 1: HEADER │
│ Attribution, type, website, repo │
├─────────────────────────────────────┤
│ ZONE 2: METADATA │
│ 7-field overview: type, purpose, │
│ philosophy, combination, security, │
│ practices, sources │
├─────────────────────────────────────┤
│ ZONE 3: SECTIONS │
│ Pattern groups with # ••••• dividers │
│ Patterns sorted alphabetically │
├─────────────────────────────────────┤
│ ZONE 4: FOOTER │
│ Customization notes │
├─────────────────────────────────────┤
│ ZONE 5: COMBINATION RECIPES │
│ cat commands for common setups │
└─────────────────────────────────────┘
# ==============================================================================
# Created by https://gitignores.com/
# [TEMPLATE TYPE] for [Technology Name]
# Website: [Official website URL]
# Repository: [Official repository URL]
# ==============================================================================Template type labels — use exactly as shown:
| Label | Directory |
|---|---|
LANGUAGE-SPECIFIC TEMPLATE |
languages/ |
COMPREHENSIVE FRAMEWORK TEMPLATE |
frameworks/ |
TOOL-SPECIFIC TEMPLATE |
tools/ |
IDE/EDITOR TEMPLATE |
ides/ |
OPERATING SYSTEM TEMPLATE |
os/ |
PLATFORM-SPECIFIC TEMPLATE |
platforms/ |
COMMON PATTERNS TEMPLATE |
common/ |
Example:
# ==============================================================================
# Created by https://gitignores.com/
# COMPREHENSIVE FRAMEWORK TEMPLATE for Django
# Website: https://www.djangoproject.com/
# Repository: https://github.com/django/django
# ==============================================================================# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# TEMPLATE OVERVIEW & USAGE NOTES
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# • TEMPLATE TYPE: [exact type from table]
# • PURPOSE: [one-sentence description]
# • DESIGN PHILOSOPHY: [Self-contained | Modular]
# • COMBINATION GUIDANCE: [how to combine]
# • SECURITY CONSIDERATIONS: [notes]
# • BEST PRACTICES: [1-2 recommendations]
# • OFFICIAL SOURCES: [attribution]Design philosophy values:
| Value | Meaning |
|---|---|
Self-contained with all [Tech]-specific patterns |
Everything included; don't combine with language templates |
Modular — combine with common templates |
Language-only patterns; must add common/security.gitignore |
Security considerations by template type:
| Template type | Required text |
|---|---|
| Framework | Includes security patterns for .env files and credentials |
| Language | No security patterns included — add common/security.gitignore |
| Common (security) | Comprehensive security patterns for protecting sensitive data |
Section divider format:
# ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
# SECTION TITLE
# ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
# Optional: one-line descriptionSection ordering:
Framework templates:
- Security & Sensitive Data Protection (always first)
- Build Artifacts & Distribution
- Dependency Management & Package Cache
- Development & Runtime Artifacts
- Framework-Specific Patterns
- Testing & Quality Assurance
Language templates:
- Build Artifacts & Distribution
- Dependency Management & Package Cache
- Development & Runtime Artifacts
- Language-Specific Patterns
- Testing & Quality Assurance
Other template types: Use relevant sections from above, ordered generic→specific.
Pattern formatting:
- Sort alphabetically within each section (case-insensitive)
- One pattern per line; no inline comments on pattern lines
- Descriptive comments for non-obvious patterns
- No trailing whitespace
- No duplicate patterns anywhere in the file
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# TEMPLATE CUSTOMIZATION & BEST PRACTICES
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# 1. REVIEW: Examine all patterns before use
# 2. CUSTOMIZE: Adapt to your project's specific structure
# 3. TEST: Use `git check-ignore` to verify patterns
# 4. SECURE: Always protect sensitive data and credentials
# 5. UPDATE: Review periodically as technology evolvesInclude at minimum one combination example. Framework templates should show combinations with IDEs and OS templates. Language templates should show common/security and a fuller toolchain example.
# EXAMPLE COMBINATION:
# cat frameworks/react.gitignore \
# ides/visual-studio-code.gitignore \
# os/macos.gitignore | sort -u > .gitignore| Rule | Example |
|---|---|
| All lowercase | react.gitignore, not React.gitignore |
| Hyphens for spaces | spring-boot.gitignore, visual-studio-code.gitignore |
| Strip special characters | csharp.gitignore (C#), nextjs.gitignore (Next.js) |
| Based on official name | adonisjs.gitignore (AdonisJS), ruby-on-rails.gitignore (Ruby on Rails) |
For JavaScript technologies, derive the filename from the GitHub repository name:
- Strip the organization prefix:
facebook/react→react - Remove dots:
vercel/next.js→nextjs - Exception: if the repo name is unrelated to the official name (e.g.,
adonisjs/corewhere "core" ≠ "adonisjs"), use the official name (adonisjs)
| Technology | GitHub Repo | File |
|---|---|---|
| React | facebook/react |
react.gitignore |
| Next.js | vercel/next.js |
nextjs.gitignore |
| Vue.js | vuejs/vue |
vue.gitignore |
| Angular | angular/angular |
angular.gitignore |
| Express.js | expressjs/express |
express.gitignore |
| Node.js | nodejs/node |
node.gitignore |
| AdonisJS | adonisjs/core |
adonisjs.gitignore |
| TypeScript | — | typescript.gitignore |
| Technology | File | Rule |
|---|---|---|
| Visual Studio Code | visual-studio-code.gitignore |
Hyphens for spaces |
| C# | csharp.gitignore |
Official name conversion |
| .NET | dotnet.gitignore |
Strip dots |
| Spring Boot | spring-boot.gitignore |
Hyphens for spaces |
| Ruby on Rails | ruby-on-rails.gitignore |
Hyphens for spaces |
MUST include a security section as the first section. Minimum patterns:
.env
.env.*
.env.*.local
.env.localAdd ecosystem-relevant patterns: certificates, cloud credentials, database files. See common/security.gitignore for the canonical reference.
common/security.gitignore organizes patterns into:
- Environment Variables & Configuration
- Credentials & Secrets Management
- Certificates & Cryptographic Keys
- SSH Keys & Authentication
- Cloud Provider Configuration
- Database & Data Storage Files
MUST NOT include security patterns. Metadata must state: Must combine with common/security.gitignore.
Before finalizing any template:
| Gate | Verification |
|---|---|
| Syntax | git check-ignore -v <test-file> — no errors |
| Dedup | sort template.gitignore | uniq -d — empty output |
| Alpha sort | Visual check: each section's patterns in A-Z order |
| Section order | Security first (frameworks), then prescribed order |
| Zone completeness | All 4 required zones present; zone 5 recommended |
| Metadata accuracy | Type, philosophy, and security fields match template content |
| Live test | git status --ignored in a test repo — works as expected |
| Cross-check | Compare against sibling templates for consistency |
mkdir -p /tmp/gt-$$ && cd /tmp/gt-$$ && git init
cp /path/to/template.gitignore .gitignore
touch .env .env.local credentials.json secret.key
git status --ignored
# Expected: all four files listed under "Ignored files"git check-ignore -v node_modules/test.js # Should show matching pattern
git check-ignore -v src/main.js # Should produce no outputcat a.gitignore b.gitignore c.gitignore | sort -u > .gitignore
git check-ignore -v .env # Should match from common/security| Mistake | Cause | Fix |
|---|---|---|
| Security section in language template | Copied from framework template | Remove all security patterns |
| Missing security in framework template | Started from language template | Add security as first section |
| Unsorted patterns | Added without sorting | Sort each section alphabetically |
| Metadata mismatch | Copy-paste error | Match metadata to template content |
!unignore without context |
Negation without path anchors | Spell out paths to unignore explicitly |
*.log too broad |
Catches changelog.md |
Use directory-specific: logs/*.log |
| Wrong directory | Followed wrong category | Review decision tree in AGENTS.md §Creating or Editing |
| Kitchen-sink templates | Adding every pattern "just in case" | Add only patterns with clear justification |
| Copy-paste from another project | Ignores unique technology needs | Research the technology's own artifacts |
| Ignoring official sources | Misses recommended patterns | Check official repos first |
| Skipping verification | Broken patterns get merged | Run full verification procedure every time |
Maintained by: gitignores.com
Repository: github.com/ronald2wing/.gitignores