Skip to main content
Back to Dev generators

Dev

Mock .gitignore Generator

A repository without a .gitignore immediately fills up with node_modules, __pycache__, .env files, and editor settings. Getting the .gitignore right from the first commit avoids a history cluttered with generated files and — critically — prevents accidental credential commits that persist in history forever even after deletion. This tool generates a stack-appropriate .gitignore with a single click. Choose between three stacks. "node" ignores node_modules/, dist/, build/, coverage/, and npm debug logs. "python" ignores __pycache__/, *.pyc, .venv/, venv/, dist/, build/, and *.egg-info/. "general" ignores logs, build output directories, and a vendor/ folder. All three stacks also include the common section: .DS_Store, Thumbs.db, .env and .env.local, and editor directories (.vscode/, .idea/). Copy the output into a .gitignore file at your repository root before your first commit. Extend it as your toolchain grows — add entries for test coverage reports, generated files, and any local config your project produces. If you accidentally committed a file before ignoring it, you must untrack it with git rm --cached before the .gitignore rule takes effect.

Read the complete guide — 4 min read

How to use

  1. Choose your options above
  2. Click Generate
  3. Copy your result

Detailed instructions

  1. Choose your stack.
  2. Click Generate to produce a .gitignore.
  3. Copy it into your repository root.
  4. Add entries for your own toolchain.

Use Cases

  • Starting a new repository
  • Learning what to ignore in Git
  • Keeping a repo clean
  • Documenting project setup
  • Ignoring secrets and build output

Tips

  • Always ignore .env and secrets.
  • Ignore dependencies and build output.
  • Group entries with comments.
  • Extend the list as you go.

FAQ

what does each stack option include

"node" ignores node_modules/, dist/, build/, coverage/, and npm-debug.log*. "python" ignores __pycache__/, *.pyc, .venv/, venv/, dist/, build/, and *.egg-info/. "general" ignores *.log, dist/, build/, out/, and vendor/. All three also ignore .DS_Store, Thumbs.db, .env, .env.local, .vscode/, and .idea/.

why is ignoring .env files so important

Committing a .env file exposes API keys, database passwords, and other credentials in your Git history — permanently, even if you delete the file and push again, because the secret remains in the old commits. Any .gitignore you use should ignore .env and .env.local from day one, before the first commit.

will adding a file to .gitignore untrack it if it was already committed

No. .gitignore only prevents untracked files from being staged. If a file is already tracked, you must run git rm --cached <file> (then commit the removal) to stop tracking it. After that, the .gitignore rule prevents it from being re-added.

can i use this .gitignore alongside a global gitignore

Yes. Git checks the per-repository .gitignore and also a global gitignore file (configured with git config --global core.excludesFile). A common pattern is to put editor and OS files (.DS_Store, .idea/) in the global gitignore and project-specific files (node_modules/, .env) in the repository's .gitignore.

You might also like

Popular tools from other categories that share themes with this one.

Try these next

More free tools from other corners of the catalog, picked by shared themes.