Skip to content
Kordu Tools Kordu Tools
Developer Tools Runs in browser Updated 18 Apr 2026

.gitignore Generator

Generate .gitignore files for Node.js, Python, Go, Rust, React, Next.js, Vite, Laravel, Django, Docker, Terraform, VS Code, macOS and more.

Languages

Frameworks

Tools & IDEs

Operating Systems

.gitignore — 3 templates selected
Loading rating…

How to use .gitignore Generator

  1. Pick your language and framework templates

    Click the templates for the languages and frameworks in your project — Node.js, Python, Go, Rust, Java, React, Next.js, Vite, Laravel, Django. Multiple selections merge automatically, so pick every runtime and framework the repo actually uses.

  2. Add operating system templates

    Select macOS, Windows, and Linux for every OS any contributor or CI agent might use. Even on a Mac-only team, adding Windows and Linux prevents `Thumbs.db` and editor backups from leaking into history later.

  3. Select your IDE or editor

    Pick VS Code, JetBrains, or both. VS Code's template keeps `settings.json`, `extensions.json`, and `launch.json` trackable so the team can share formatter and debugger configs; JetBrains ignores the whole `.idea/` directory by default.

  4. Review the generated output

    The merged .gitignore appears in the output panel with labelled sections per template. Duplicate patterns are removed automatically. Scan it once to make sure nothing important is being excluded.

  5. Copy and save as .gitignore

    Click Copy, then save the content as a file literally named `.gitignore` (with the leading dot) at the root of your repository. Add any project-specific patterns — build artefacts, local scripts, personal notes — at the bottom.

  6. Untrack files that are already committed

    If `node_modules/`, `.DS_Store`, or `.env` are already in history, `.gitignore` alone will not remove them. Run `git rm -r --cached <path>` to untrack each, then commit the deletion. New clones will skip those paths and the ignore rule will start enforcing.

  7. Verify with `git check-ignore`

    Run `git check-ignore -v path/to/file` on anything surprising — it prints the exact pattern and line that matched (or didn't). `git status --ignored` lists every path Git is currently hiding, which is the fastest sanity check before pushing.

.gitignore Generator FAQ

Can I combine multiple templates in one .gitignore?

Yes. Select as many templates as you need and they are merged into a single .gitignore with a labelled section per template (`# Node.js`, `# Python`, `# macOS`, etc.). Duplicate patterns across templates are deduplicated automatically so the output stays clean.

How do globs like `**/node_modules` work?

`**` matches zero or more directory segments. `**/node_modules` matches `node_modules` at any depth — root, `packages/foo/node_modules`, anywhere. A plain `node_modules/` without the glob still matches at any depth in Git's default semantics, but `**/` makes the intent explicit and is safer in monorepos.

How do I undo tracking of a file I've already committed?

`.gitignore` only blocks new files from being tracked — it doesn't affect what's already in history. Run `git rm --cached path/to/file` (or `git rm -r --cached node_modules/` for a directory) to untrack it while leaving the file on disk, then commit the deletion. Future clones skip the path and the ignore rule starts working.

Is there a global gitignore for patterns I don't want to commit per-repo?

Yes. Set one up with `git config --global core.excludesfile ~/.gitignore_global`, then add personal patterns there — editor swap files, OS junk, local scripts. Global rules apply to every repo on your machine without polluting the shared `.gitignore` with preferences your teammates don't share.

Should I commit `.env.example` or ignore it?

Commit `.env.example` — it documents which environment variables the app needs without leaking real values. Only `.env`, `.env.local`, and `.env.*.local` should be ignored. A committed example file is how new contributors know what to put in their own `.env`.

Should `package-lock.json` and other lock files be committed?

Yes, almost always. `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, `bun.lockb`, `Pipfile.lock`, `poetry.lock`, `Gemfile.lock`, and `composer.lock` pin exact dependency versions so CI, teammates, and production all install the same tree. Rust's `Cargo.lock` is committed for binaries and ignored for libraries.

Why are Thumbs.db and .DS_Store such a big deal?

They are generated by the OS automatically — macOS writes `.DS_Store` the moment a Finder window opens a directory, Windows writes `Thumbs.db` in folders with images. They carry no useful information for other contributors, produce constant merge noise, and occasionally leak directory structure you'd rather not share. Always ignore them, on every OS, in every repo.

Why is `.gitignore` itself tracked by Git?

`.gitignore` is part of the project's shared configuration — every teammate needs the same ignore rules, so it lives in the repo and gets committed like any other file. The file describes what Git should ignore inside the working tree; it is not itself ignored.

How do I ignore an entire directory but keep one file inside it?

You cannot negate a file inside a fully-ignored directory. Instead, ignore the contents (`logs/*`), then negate the file (`!logs/keep.log`). The parent directory is never listed as ignored, so Git can still walk into it and re-include the exception. If you use `logs/` with the trailing slash, the negation will not work.

What's the difference between `.gitignore` and `.git/info/exclude`?

`.gitignore` lives inside the repo, is committed, and applies to every clone. `.git/info/exclude` lives inside the local `.git` directory, is never committed, and applies only to your clone. Use `.gitignore` for shared project rules and `.git/info/exclude` for one-off local scratch files you don't want to impose on the team.

Can I use regex in .gitignore?

No. `.gitignore` uses shell glob patterns (`*`, `?`, `[abc]`, `**`), not regex. There is no alternation, no lookahead, no anchors other than the leading `/` for root and trailing `/` for directories. For anything more complex, write multiple glob lines.

How do I test whether a pattern matches the file I expect?

`git check-ignore -v path/to/file` prints the exact `.gitignore` line that matched (or exits non-zero if nothing matches). `git status --ignored` lists every currently-ignored path. Both commands are the fastest way to debug surprising behaviour around negation patterns and deep globs.

Does .gitignore affect files already tracked by Git?

No. `.gitignore` only prevents untracked files from being added. If a file is already tracked, `git rm --cached path` will untrack it without deleting the working copy; commit the deletion and future clones will honour the ignore rule.

Is my data sent anywhere?

No. All template composition and de-duplication happens entirely in your browser. Nothing you pick or generate is transmitted, stored, or logged. The tool is pure client-side JavaScript with no backend and no rate limits.

Background

The Kordu .gitignore Generator produces ready-to-commit .gitignore files by combining curated templates for the languages, frameworks, IDEs, and operating systems in your project. Pick any combination of 17 templates and the sections are merged, labelled, and de-duplicated into a single copy-ready file. Defaults to Node.js + VS Code + macOS — the most common web developer stack — but every template is opt-in so you end up with patterns that match your actual repository and nothing you don't need.

What .gitignore does and why it matters

A .gitignore file lives at the root of your repository (or inside any subdirectory) and tells Git which paths to leave untracked. Compiled output, dependency trees, IDE metadata, OS junk files, build caches, virtual environments, and secrets should never enter version control — they bloat the repo, leak environment-specific state across machines, trigger noisy diffs, and in the worst case commit credentials to a public history. A well-written .gitignore is the single most effective way to keep your repository clean, portable, and safe.

Anatomy of a gitignore rule

Each non-empty, non-comment line in .gitignore is a pattern. Patterns follow shell glob syntax with a few Git-specific extras:

  • *.log — match any file ending in .log in any directory
  • build/ — trailing slash means match directories only
  • /secrets.json — leading slash anchors the pattern to the repo root
  • **/node_modules — the double-star globs across any depth
  • docs/**/*.pdf — recursive match inside docs/
  • !important.log — a leading ! negates a previous ignore, re-including the file
  • # comment — lines starting with # are ignored (use \# to match a literal #)
  • Blank lines are allowed and help readability; they have no effect.

Order matters for negation: a !pattern only works if none of its parent directories are ignored. If you ignore logs/ you cannot re-include logs/keep.log — you must ignore logs/* instead and then negate the file.

How the 17 templates compose

Select any combination of templates and the generator merges them into one file with a labelled header per section (# Node.js, # Python, # macOS and so on). Duplicate patterns that appear in more than one template are emitted once, and the output is sorted by section so diffs stay stable when you add or drop a stack later. The templates cover:

  • Language runtimes — Node.js (node_modules/, npm-debug.log*, .pnpm-store/), Python (__pycache__/, *.py[cod], .venv/, *.egg-info/), Go (vendor/ optional, *.exe, *.test, coverage profiles), Rust (target/, Cargo.lock for libraries, **/*.rs.bk), Java (*.class, target/, build/, *.jar).
  • Frontend and backend frameworks — React (build/, .eslintcache), Next.js (.next/, out/, .vercel), Vite (dist/, dist-ssr/, .vite/), Laravel (/vendor, /node_modules, storage/*.key, .env), Django (*.sqlite3, media/, staticfiles/, local_settings.py).
  • Editors and IDEs — VS Code (.vscode/* minus shared settings.json, extensions.json, launch.json), JetBrains (.idea/, *.iml, out/).
  • Operating systems — macOS (.DS_Store, ._*, .AppleDouble, .Spotlight-V100), Windows (Thumbs.db, ehthumbs.db, Desktop.ini, $RECYCLE.BIN/), Linux (*~, .Trash-*, .nfs*).
  • Infrastructure tools — Docker (*.pid, .docker/), Terraform (.terraform/, *.tfstate, *.tfstate.backup, .terraform.lock.hcl kept committed).

Framework-specific gotchas worth knowing

Next.js produces .next/ for dev builds and out/ for next export — both need to be ignored. Vite writes to dist/, not build/, so a stale React template alone will miss it. Create React App uses build/. Django developers often forget to ignore local_settings.py and *.sqlite3, leaking developer databases into history. Laravel ships with its own .gitignore in new projects; if you are migrating an older repo, make sure /storage/*.key, /bootstrap/cache/, and .env are all listed. Rust library crates should ignore Cargo.lock; binary crates should commit it so release builds reproduce.

OS traps that pollute every repo

macOS writes .DS_Store into every directory a Finder window has ever opened, and they sneak into commits the moment a teammate browses src/ in a GUI. Windows drops Thumbs.db, ehthumbs.db, and Desktop.ini in folders with images; Linux produces editor backups like *~ and NFS lock files like .nfs0001. Add all three OS templates even when your team is uniformly on one platform — CI agents, contractors, and future maintainers may not be. A shared repo gets OS junk from every contributor, not just you.

IDE noise and the shared-settings split

JetBrains (.idea/) and VS Code (.vscode/) are both user-specific by default, but VS Code projects frequently want to commit shared settings: settings.json, extensions.json, and launch.json ensure everyone has the same formatter, recommended extensions, and debug configurations. The generated VS Code template ignores the folder but re-includes those three files via negation patterns. Delete the negations if your team prefers a strictly private .vscode/ directory, or extend them if you standardize tasks.json too.

Secrets and credentials: ignore first, audit always

Any file that could leak a credential belongs in .gitignore before you even write the secret. Always ignore .env, .env.local, .env.*.local, *.pem, *.key, id_rsa*, credentials.json, service-account*.json, and .npmrc if it contains auth tokens. Keep .env.example (note the .example suffix) committed so teammates know which variables the app needs — documenting shape without leaking values is the whole point. If a secret ever lands in history, rotating it is the only real fix: git rm leaves the leaked value in prior commits, and force-pushing over a public history is not a containment strategy.

Lock files: generally commit, don't ignore

package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb, Pipfile.lock, poetry.lock, Gemfile.lock, Cargo.lock (for binaries), and composer.lock all pin exact dependency versions. Commit them so CI, teammates, and production all install the same tree. None of the built-in templates ignore them, and you should not add them manually unless you have a very specific reason.

The most common .gitignore mistake: forgetting already-tracked files

.gitignore only prevents Git from starting to track new files — it does nothing to files already under version control. If node_modules/ made it into your repo before you added the ignore rule, a fresh rule will not clean it up. Run git rm -r --cached node_modules to untrack everything under that path while leaving the files on disk, commit the deletion, then future clones will not pull those files and the ignore rule will start working. The same applies to .DS_Store, compiled artifacts, and any secret that slipped in — untrack, commit, then rotate the secret.

Testing and debugging your rules

git check-ignore -v path/to/file tells you exactly which line in which .gitignore matched (or didn't). git status --ignored lists files the rules are currently hiding. Use them whenever a pattern surprises you — especially when debugging negation and deep globs, which have notoriously non-obvious semantics.

Global vs per-repo vs .git/info/exclude

Three levels of ignore exist, each with its own scope:

  • Per-repo .gitignore (checked in) — shared with the team; this is what the generator produces.
  • Global ~/.gitignore_global — configured via git config --global core.excludesfile ~/.gitignore_global. Ideal for personal editor and OS patterns you don't want to impose on teammates.
  • .git/info/exclude — per-clone, never shared, never committed. Useful for one-off local scratch files.

A common pattern is: keep the OS and IDE templates in your global ignore, and keep only language and framework patterns in the per-repo file. That keeps team repos focused on the project itself.

Comparison to toptal/gitignore.io and github/gitignore

The canonical community sources are GitHub's github/gitignore repository and the toptal/gitignore.io service. Both ship hundreds of templates and are excellent for obscure stacks. The Kordu generator targets the 17 templates that cover >90% of modern web, mobile, and infrastructure projects, merges them with a sharper UI, and ships zero dependencies — no API calls, no external service, no signup. Your selections never leave the browser.

Privacy and data processing

All template composition and de-duplication happens entirely in your browser. Kordu does not upload, log, or store your selections or the generated output. The tool is pure client-side JavaScript: no backend, no rate limits, no signup, and it works offline once the page has loaded.