Ttooleras
📝

.gitignore Generator

Developer Utilities

Create .gitignore files for 100+ languages, OS, IDEs — combinable templates. Free, private — all processing in your browser.

Select technologies

.gitignore output

Advertisement

The Gitignore Generator creates comprehensive .gitignore files by combining templates for your project stack. Select your language(s) (Node.js, Python, Java, Go, Rust, PHP, Ruby, C#, Swift, and 90+ others), operating systems (macOS, Windows, Linux), and IDEs (VS Code, IntelliJ, Visual Studio, Xcode, Android Studio) — the tool merges canonical templates from GitHub's gitignore repository plus curated additions for modern frameworks (Next.js, React, Vue, Django, Flask, Spring Boot, etc.) into a single optimized .gitignore.

A good .gitignore keeps your repository clean by excluding: build artifacts (dist/, target/, build/), dependencies (node_modules/, venv/, vendor/), OS metadata (.DS_Store, Thumbs.db, desktop.ini), IDE configs (.idea/, .vscode/ — sometimes), logs (*.log, logs/), secrets (.env, *.pem), and build caches (.next/, .nuxt/, .cache/). Without a proper gitignore, your repository bloats with machine-specific files, IDE junk accumulates in commits, and worst — secrets leak into git history. This tool creates the right .gitignore in seconds.

.gitignore Generator — key features

100+ language templates

Every common language: JavaScript/Node, Python, Java, Go, Rust, C#, Ruby, PHP, Swift, Kotlin, Scala, Elixir, Clojure, Haskell, and many more.

Framework-specific

React, Next.js, Vue, Angular, Django, Flask, Rails, Laravel, Spring Boot, .NET Core, Unity, Unreal — with framework-specific build artifacts.

Operating systems

macOS (.DS_Store), Windows (Thumbs.db, desktop.ini), Linux. Combine for cross-platform teams.

IDEs and editors

VS Code, IntelliJ IDEA, Visual Studio, Xcode, Android Studio, Sublime, Vim, Emacs.

Custom additions

Add your own patterns. Project-specific files, company conventions.

Preview before download

See the complete combined .gitignore. Remove sections you don not need.

Deduplication

Combining multiple templates may produce duplicate lines. Tool deduplicates automatically.

Up-to-date

Based on GitHub's gitignore repository which is maintained actively. New frameworks added regularly.

How to use the .gitignore Generator

  1. 1

    Select your language

    Pick main language(s): Node.js, Python, Java, Go. Combine for multi-language projects.

  2. 2

    Add framework if applicable

    Next.js, Django, Spring Boot. Framework-specific build artifacts and caches.

  3. 3

    Add OS templates

    For team with mixed OS, combine macOS + Windows. Solo developer: just your OS.

  4. 4

    Add IDE templates

    Your IDE plus teammates IDEs. Prevents IDE-specific files from polluting commits.

  5. 5

    Review combined output

    Preview the final .gitignore. Remove sections that do not apply.

  6. 6

    Add custom rules (optional)

    Project-specific exclusions your templates do not cover.

  7. 7

    Download

    Save as .gitignore in your project root. Commit it as the first commit of a new project, or add to existing.

Common use cases for the .gitignore Generator

Starting new projects

  • New Node.js/TypeScript project: Generate .gitignore for Node + your OS + VS Code in seconds. No manual research.
  • New Python Django project: Ignore __pycache__, venv, static collectstatic output, .pytest_cache, etc.
  • New Go microservice: Ignore go vendor, *.exe, binary output.
  • New Rails application: Ignore log/, tmp/, Storage, credentials, bundler cache.
  • New .NET project: Ignore bin/, obj/, .vs/, *.suo, *.user files.

Existing projects

  • Adopted project has incomplete gitignore: Generate complete version and merge. Catch files you accidentally track.
  • Onboarding new team member with different OS: Add OS-specific entries for new team member platform (macOS dev joins Windows team).
  • Switching IDE: Adopt Visual Studio while team uses VS Code — add Visual Studio entries.
  • Migration to new framework: Adding Next.js to existing React project — add Next-specific entries (.next/).

Cross-platform

  • Multi-OS team: macOS developers + Windows + Linux — combined .gitignore excludes metadata from all three.
  • Mobile + backend: iOS (Xcode) + Android (Android Studio) + Node backend — triple template combination.
  • Monorepo: Multiple languages in one repo — combine all language templates.
  • Full-stack JavaScript: Frontend + Backend (Node) + Database migrations — comprehensive coverage.

Security

  • Prevent secret leaks: All templates include common secret file patterns (*.env, *.key, credentials.json).
  • Exclude API keys: Specific .env, config/secrets/, *.pem, credentials are always ignored.
  • SSH/TLS keys: *.key, *.pem, id_rsa, id_dsa automatically excluded.
  • Database dumps: *.sql.dump, database.db, *.sqlite, *.db excluded (may contain sensitive data).

.gitignore Generator — examples

Node.js + macOS + VS Code

Common full-stack developer combo.

Input
Node.js + macOS + VS Code
Output
# Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
.env
.env.*.local
dist/
build/

# macOS
.DS_Store
.AppleDouble
.LSOverride

# VS Code
.vscode/
!.vscode/settings.json

Python + Django

Django project baseline.

Input
Python + Django
Output
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
*.egg-info/
.pytest_cache/
venv/
.venv/

# Django
*.log
media/
staticfiles/
.env
db.sqlite3

Go project

Go microservice.

Input
Go + Unix
Output
# Binaries
*.exe
*.exe~
*.dll
*.so
*.dylib
*.test
*.out

# Go workspace
go.work

# Vendor
vendor/

Rust library

Rust crate.

Input
Rust + VS Code
Output
# Cargo
target/
*.rs.bk

# Do NOT commit Cargo.lock for libraries
Cargo.lock

# VS Code
.vscode/
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json

Full-stack Next.js

Next.js frontend + Node backend.

Input
Next.js + Node.js + macOS + Windows
Output
# Next.js
.next/
out/
node_modules/
.env*
!.env.example

# macOS
.DS_Store

# Windows
Thumbs.db
Desktop.ini

Combined with custom

Add project-specific rules.

Input
Node.js + custom rules
Output
# Node.js (template)
node_modules/
dist/

# Custom: exclude generated files
generated/
*.generated.*

# Custom: exclude personal notes
NOTES.md
TODO.md

Technical details

.gitignore files tell Git which files to ignore in a repository. Once a file is ignored, Git will not track changes to it or include it in commits.

Syntax:

```
# Comments start with #

# Ignore specific file
secrets.txt

# Ignore all .log files
*.log

# Ignore entire directory
node_modules/

# Negation: track this even though parent pattern ignored
!important.log

# Match any level of nesting
**/logs/*.log

# Match at root only
/build

# Match all .tmp files anywhere
*.tmp
```

Pattern rules:

- * — matches anything except / (does not cross directories)
- ** — matches anything including / (crosses directories)
- ? — matches single character
- [abc] — character class
- / prefix — match only at root
- / suffix — only directories
- ! prefix — negation (re-include)
- # — comment
- Blank lines ignored

Precedence:

Later rules override earlier ones. Use ! to re-include files that would be ignored by an earlier pattern.

Global gitignore:

You can set a global .gitignore for all your repositories:

``bash
git config --global core.excludesfile ~/.gitignore_global
``

Put personal preferences in global (IDE configs, OS files). Put project-specific in project gitignore (node_modules, dist). Do not put personal files in project gitignore — contaminates teammates.

Common categories:

Language-specific:

- Node.js: node_modules/, .env*, *.log, dist/
- Python: __pycache__/, *.pyc, venv/, .pytest_cache/, *.egg-info/
- Java: target/, *.class, *.jar
- Go: vendor/, *.exe, *.test
- Rust: target/, Cargo.lock (for libraries)

OS-specific:

- macOS: .DS_Store, .AppleDouble, ._*, Icon?, Thumbs.db, ehthumbs.db
- Windows: desktop.ini, *.lnk, *.bak, $RECYCLE.BIN/
- Linux: .directory, .Trash-*, *~

IDE-specific:

- VS Code: .vscode/ (if sharing settings, commit .vscode/settings.json but ignore .vscode/*.log)
- IntelliJ: .idea/ (team-level or personal depending on team decision)
- Vim: *.swp, *.swo, tags
- Emacs: *~

Secrets and sensitive:

- *.env files (exceptions: .env.example)
- *.pem, *.key (private keys)
- credentials.json, secrets/
- *.p12, *.keystore

Build artifacts:

- dist/, build/, out/, bin/, obj/, target/
- *.exe, *.dll, *.so, *.dylib
- Coverage reports: coverage/, *.lcov

Important exceptions:

- package-lock.json, yarn.lock, Cargo.lock (applications) — include these
- *.pem.example (template) — include
- .env.example — include

Team-level decisions:

- .vscode/settings.json — commit if team shares settings, ignore if personal
- .idea/ — usually ignored, but some teams share certain files
- dist/ (for libraries) — depends if you publish from repo

Useful combinations:

A Node.js full-stack project typically needs templates for:
- Node.js (language)
- Next.js or React (framework)
- macOS (your OS)
- Windows (teammate OS)
- VS Code (IDE)

Common problems and solutions

Already-tracked files still shown as modified

.gitignore only affects untracked files. Files already in git history remain tracked. Remove from tracking with: git rm --cached path/to/file. Then commit and gitignore takes effect.

Committed secrets stay in history

Adding .env to .gitignore doesn not remove it from past commits. Use git filter-repo or BFG Repo-Cleaner to remove from history. Then rotate the secrets — assume they are compromised once in history.

Team disagreement on IDE files

.vscode/ and .idea/ debate is endless. Common compromise: ignore most IDE files but commit shared settings (.vscode/settings.json for shared prettier config). Team convention matters.

package-lock.json confusion

Committing lock files is debated. Convention: **commit** lock files for applications (ensures reproducible dependency trees). **Do not commit** for libraries published to npm (users get flexibility).

Accidentally ignoring tracked files

If a file is already tracked and you add it to gitignore, Git ignores the ignore rule. Must remove from tracking: git rm --cached file.txt. Alternative: use git update-index --assume-unchanged for personal overrides.

Global vs project gitignore

Personal preferences (OS files, your IDE) in global gitignore (~/.gitignore_global). Project-specific (build output, dependencies) in repository .gitignore. Do not pollute team repo with your personal preferences.

Nested .gitignore files

Subdirectories can have their own .gitignore. Patterns are relative to that subdirectory. Useful for monorepos where different packages have different needs. Just be aware they exist when debugging ignore behavior.

Patterns with leading slash

Leading / anchors to root of repository. node_modules matches node_modules/ anywhere; /node_modules only at root. Important when same directory name appears at multiple levels.

.gitignore Generator — comparisons and alternatives

Tool-generated vs hand-written .gitignore: Tool-generated covers 95% of common cases with proven patterns. Hand-written is for specific project needs. Start with generator, customize after.

Global vs project gitignore: Global (~/.gitignore_global) is personal preferences across all your projects. Project (.gitignore in repo root) is shared with team. Keep personal out of project gitignore.

.gitignore vs .dockerignore: Similar syntax, different purposes. .gitignore: files excluded from git commits. .dockerignore: files excluded from Docker build context. Usually different content (gitignore excludes node_modules for git; dockerignore excludes it for build context too).

.gitignore vs .npmignore: .npmignore: files excluded from npm package publish. If absent, npm uses .gitignore. Usually different — .gitignore keeps tests and docs in repo; .npmignore excludes them from published package.

.gitignore vs git attributes: .gitignore excludes files. .gitattributes sets per-file attributes (eol, diff, merge). Both committed to repo.

GitHub templates vs Toptal: Both offer gitignore templates. GitHub maintains the primary canonical source at github.com/github/gitignore. Toptal has a nice UI. This tool uses GitHub templates.

Frequently asked questions about the .gitignore Generator

What is a .gitignore file?

.gitignore is a plain text file at the root of a Git repository that tells Git which files and directories to ignore. Files matching patterns in .gitignore are not tracked — never committed, never modified in Git workflow. Essential for keeping build artifacts, dependencies, and secrets out of version control.

How do I create a gitignore?

Create a file named .gitignore (with leading dot) in the root of your repository. Add patterns, one per line. Commit it. Git will ignore matching files. This tool generates comprehensive starting .gitignore for your stack in seconds.

What should be in my .gitignore?

Build artifacts (dist/, target/, build/), dependencies (node_modules/, venv/, vendor/), secrets (.env, *.key, *.pem), OS metadata (.DS_Store, Thumbs.db), IDE configs (if team convention says so), logs (*.log), caches (.next/, .pytest_cache/, .cache/), test coverage (coverage/). Everything generated from source or personal to your machine.

Do I commit .gitignore itself?

Yes. .gitignore is committed to the repository so all team members use the same ignore rules. It is one of the first files in any new repository.

What are common .gitignore mistakes?

(1) Forgetting about already-tracked files — gitignore only affects untracked files. (2) Committing secrets and then adding to gitignore — secrets stay in history. (3) Putting personal preferences in project gitignore — pollutes team repo. (4) Missing OS-specific files — .DS_Store gets committed from Macs.

Can I undo a file from being ignored?

Yes. Add a negation pattern: !filename. Example: to ignore all .log files except important.log: *.log followed by !important.log. Order matters — negation must come after the pattern it negates.

Should I commit node_modules?

No. Always in .gitignore. Dependencies are installed from package.json + package-lock.json. Committing node_modules bloats the repo (thousands of files) and causes merge conflicts.

What about .env files?

Always ignore. .env contains secrets (database URLs, API keys, auth tokens). Committing .env leaks credentials. Convention: commit .env.example with placeholder values; everyone creates their own .env locally.

Should I ignore .vscode/ or .idea/?

Depends on team convention. Some teams share IDE settings (commit .vscode/settings.json with project-specific prettier config). Others keep it personal (ignore all .vscode/). Decide with team; be consistent.

What if my .gitignore is not working?

Check: (1) File is named exactly .gitignore (with dot). (2) File is at repository root (or correct subdirectory). (3) Matching files are NOT already tracked (git rm --cached file if they are). (4) Pattern syntax is correct — test with git check-ignore -v file to see which rule matches.

Additional resources

Advertisement

Learn more

Explore more tools

200+ free tools that run in your browser.

Browse all tools →