.gitignore Generator

Next

A missing .gitignore is how API keys end up in Git history and how 400 MB of node_modules gets pushed to GitHub. This generator outputs a tested template for your stack, Node, Python, Rails, or Laravel, with dependency folders, build output and environment files already excluded.

How to generate a .gitignore

  1. 1

    Pick your stack

    Node, Python, Rails or Laravel: each has its own set of transient artefacts.

  2. 2

    Generate

    The tool merges common rules (.DS_Store, .env, node_modules) with stack-specific ones.

  3. 3

    Save as .gitignore

    Place the file at the repo root before the first commit.

  4. 4

    Commit it

    .gitignore itself should be tracked: it is part of the project, not a local preference.

Why the common block is always present

Rule Reason to ignore
.DS_Store macOS Finder metadata, never useful to other machines
.env Secrets: API keys, database passwords, OAuth credentials
.env.* Environment-specific variants (staging, production)
!.env.example But keep the example file so new contributors know the shape
node_modules/ Installable from package.json; huge and platform-specific

Stack-specific additions

Stack Key additions
Node dist/, coverage/, npm-debug.log*
Python __pycache__/, .venv/, *.pyc, .pytest_cache/
Rails log/*, tmp/*, storage/*, /public/assets
Laravel vendor/, /storage/*.key, /public/build, .phpunit.cache/

Common mistakes

  • Committing .env early, then adding it to .gitignore. The file is already in history, use git rm --cached .env and rotate every secret that was in it.
  • Ignoring .env.example along with .env. Teammates need the example to bootstrap.
  • Too-broad globs: *.log can hide production-critical log configs; be more specific when in doubt.
  • Platform-specific files not local to you: contribute them via a shared .gitignore, not a personal one.

Personal vs project gitignore

For editor files unique to you (JetBrains IDEs, Emacs) use your global gitignore (~/.config/git/ignore) rather than bloating each project’s.

Frequently Asked Questions

Because .gitignore only prevents untracked files from being added. Run git rm --cached path/to/file to stop tracking an already-committed file, commit the change, and the rule will then exclude it.

No, lockfiles should be committed so every environment installs the exact same versions. Ignoring them re-introduces the “works on my machine” class of bug.

A leading slash anchors the pattern to the repo root. /logs matches only a top-level logs/ directory, while logs matches any logs directory at any depth.

No. The generated file is not stored or tracked. Your stack choice is sent to our server so the rules can be built, and in the multi-step mode it is also carried in the page link, but the file contents are not kept.

Related Tools

Tool available in other languages