No cookies · No tracking · Runs entirely in your browser

.gitignore Generator

Pick your stack, get a ready-to-use .gitignore

← devnestio
Select Templates
Selected
None
Custom Patterns
Generated .gitignore

What is Gitignore Generator?

Gitignore Generator creates .gitignore files for any combination of languages, frameworks, and tools. Select Node.js, Python, Go, Java, macOS, Windows, VS Code, IntelliJ, Docker, and dozens more, and the generator produces a comprehensive .gitignore that excludes build artifacts, dependencies, editor-specific files, OS metadata, and environment files — all based on the official gitignore.io database.

A .gitignore file tells Git which files and directories to exclude from version control. Without it, running git add . would track node_modules (hundreds of MB), Python __pycache__ directories, macOS .DS_Store metadata files, Java .class bytecode, editor workspace files, and .env secrets — none of which should be in a repository. A proper .gitignore prevents accidental commits of secrets, build artifacts, and environment-specific files.

The most critical files to exclude: .env and other files containing secrets (API keys, database credentials), lock files that conflict between developers' environments (depending on policy), OS files (.DS_Store, Thumbs.db), editor files (.idea/, .vscode/settings.json), build output (dist/, build/, target/), and dependency directories (node_modules/, vendor/, __pycache__/).

How to Use

  1. Select all languages and tools used in your project (e.g., Node, Python, macOS, VS Code).
  2. Click Generate to create the combined .gitignore content.
  3. Review the output — each section is labeled with the tool it covers for easy navigation.
  4. Copy the content and save it as .gitignore in your project root.
  5. Commit the .gitignore file to your repository as one of the first commits in a new project.

Examples

Node.js + macOS + VS Code

Result: Ignores: node_modules/, .env, .env.local, .DS_Store, .vscode/settings.json, dist/, .npm, npm-debug.log

Python + Linux + JetBrains

Result: Ignores: __pycache__/, *.pyc, *.pyo, .env, venv/, .idea/, *.iml, dist/, *.egg-info/

Go + Windows + VS Code

Result: Ignores: *.exe, *.exe~, *.dll, Thumbs.db, Desktop.ini, .vscode/settings.json, vendor/ (if not committed)

Frequently Asked Questions

Should I commit node_modules or vendor directories?

Generally no — these directories can be hundreds of MB and are reproducible from package.json or go.mod. The exception: some Heroku deployments require node_modules committed. For Go, vendoring (committing vendor/) is sometimes preferred for reproducible builds without internet access. Default: exclude and install from lock file in CI.

Should I commit lock files (package-lock.json, yarn.lock)?

Yes — lock files ensure all developers and CI environments install exactly the same dependency versions. Commit package-lock.json, yarn.lock, pnpm-lock.yaml, Pipfile.lock, and go.sum. Exclude the tool-generated lock files for package managers you don't use.

How do I ignore a file that was already committed?

First add the file to .gitignore, then run: git rm --cached to remove it from Git's tracking while keeping the local copy. Commit the deletion. Future changes to that file will be ignored. Warning: if others have this file, they will see it as deleted in git status until they run git checkout.

Can I have multiple .gitignore files?

Yes — .gitignore files can exist in any directory and apply to that directory and its subdirectories. The root .gitignore covers the whole repository. Subdirectory .gitignore files are useful for monorepos where different packages have different ignore rules.

How do I force-add a file that is gitignored?

Use git add -f (force add). This is useful for committing an intentionally-blank .gitkeep file in an otherwise-empty directory, or for committing an exception to a pattern. To make an exception permanent, add a negation pattern to .gitignore: !important-file.txt overrides a broader *.txt ignore rule.

Related Tools