Create a .gitignore for the project you actually use
A repository can collect dependency folders, compiler output, test reports and local editor files before its first useful commit. A gitignore generator gives you a starting file for that mix of tools. Choose the parts of your stack, inspect the combined rules, and add only the project-specific paths you need.
The workspace above generates plain text as you select templates. It includes comments that identify each group and keeps your custom rules at the end. Preset buttons replace the template selection while retaining custom rules; Clear all removes both. A search filters the available choices without removing your selections.
Download the result as .gitignore, including the leading dot. If your repository already has one, compare and merge the rules instead of overwriting exceptions you still need. Commit the reviewed file so teammates share the project’s ignore policy.
Combine a language, framework, editor and operating system
For a Next.js repository, choose Node.js for installed dependencies and Next.js for framework output. Vite projects can combine Node.js with Vite / React / Vue. The Python template targets bytecode, virtual environments and testing caches. Maven and Gradle have separate choices, so select the build system your Java project actually uses.
Editor rules are deliberately narrow: VS Code settings and shared JetBrains configuration are not excluded wholesale. Operating-system templates cover local metadata. For personal rules that should not apply to every contributor, consider your own Git excludes configuration instead of adding them to a shared project file.
These are compact, built-in starter templates. They do not inspect your repository or detect tools automatically. Dependencies, logs and build output may live at different paths in a monorepo; use Custom rules to reflect that layout.
Three .gitignore starting points
Next.js project
Dependencies, Next.js output and macOS metadata. Lockfiles stay available to commit.
Try the preset above ↑# Generated with LightNode Gitignore Generator
# Review these starter rules before adding them to your project.
# Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-store/
coverage/
.nyc_output/
# Next.js
.next/
out/
.vercel/
*.tsbuildinfo
# macOS
.DS_Store
._*
.Spotlight-V100/
.Trashes/
Python workspace
Python caches, virtual environments, VS Code history and Linux backup files.
Try the preset above ↑# Generated with LightNode Gitignore Generator
# Review these starter rules before adding them to your project.
# Python
__pycache__/
*.py[cod]
.venv/
venv/
.pytest_cache/
.mypy_cache/
.ruff_cache/
.coverage
htmlcov/
*.egg-info/
# VS Code
.history/
*.vsix
# Linux
.Trash-*/
*~
Java with IntelliJ
Maven or Gradle artifacts with personal JetBrains state and Windows metadata. Remove the unused build tool.
Try the preset above ↑# Generated with LightNode Gitignore Generator
# Review these starter rules before adding them to your project.
# Java / Maven
*.class
target/
# Gradle
.gradle/
build/
# JetBrains IDEs
.idea/workspace.xml
.idea/tasks.xml
.idea/shelf/
.idea/httpRequests/
# Windows
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
A short .gitignore pattern reference
| Pattern | Meaning |
|---|---|
*.log | Match log filenames at any depth. |
/local-data/ | Ignore this directory at the location of this .gitignore. |
cache/ | Ignore directories named cache. |
!important.log | Re-include a matching path, unless its parent directory is excluded. |
# Note | A comment; escape a leading # to match it literally. |
Order matters: at the same precedence level, the last matching pattern wins. To keep selected files under a directory, avoid excluding the parent itself; for example, use /logs/* followed by !/logs/keep.log. See the Git ignore documentation for nested files, precedence and escaping.
Gitignore generator: common questions
How do I generate a .gitignore file?
Select your language or framework, then add your editor and operating system if needed. The preview updates automatically. Add project-specific rules, review the result, and copy it or download a file named .gitignore. Place it in the repository root or merge the rules into your existing file.
Why is a file still appearing after I add it to .gitignore?
Ignore rules do not affect files Git already tracks. Check git status and use git check-ignore -v --no-index path/to/file to inspect matching rules independently of the index. If you decide a tracked file should become untracked, git rm --cached -- path/to/file stages its removal from the repository while keeping your local copy. Review and commit that change deliberately.
Does this tool use the full GitHub template collection?
No. These are concise starter templates maintained with this tool, not a live mirror of GitHub’s gitignore collection. They cover common local artifacts rather than every framework version or project layout. Review the preview and add rules for your own build process.
Should I ignore package lockfiles?
The templates here leave package-lock.json, yarn.lock, pnpm-lock.yaml, Cargo.lock, composer.lock and Gemfile.lock available to commit. Lockfile policy depends on the ecosystem and whether you publish an application or library. Choose it intentionally with your team rather than ignoring every lockfile by default.
Can I keep example environment files?
The optional Local environment files template ignores .env and .env.* and includes exceptions for .env.example and .env.sample. Add further exceptions in Custom rules if needed. This does not scan for secrets or remove data from existing commits; example files should contain only safe placeholder values.
Are my rules uploaded or saved?
Generation happens in your browser with bundled templates. The tool does not upload a repository, call a generation API, persist custom rules or put them into the URL. Copying and downloading export the generated text when you choose.
Why does the output keep repeated patterns?
Rules are grouped in a fixed template order, followed by your custom lines. The generator preserves repeated patterns and negations instead of sorting or globally deduplicating them, so it does not silently move an exception or remove a later override. Always check the combined result against your project.
