.gitignore Generator

Runs 100% in your browser

Generate or audit a .gitignore file in your browser — 82 templates, 12 one-click profiles, smart dedup, validate mode, custom rules, and zero upload. Covers Node, Python, Java, Kotlin, Go, Rust, React, Angular, Vue, Flutter, Unity, Docker, Terraform, and more.

Repository Tools · .gitignore Generator

Build the perfect .gitignore for every project you ship

82 templates — languages, frameworks, IDEs, OS, CI. Merge any combination, audit an existing file, simulate against a real file tree, get CLI snippets, and download — nothing leaves your browser.

Private by architecture

Choose your stack

0 templates selected

Selections merge in stable category order. Duplicate rules are removed automatically, regardless of which order you select templates.

Quick-start profiles

One rule per line. Comments are preserved. Negation rules such as !config.example.json are flagged when they may depend on rule order.

Select at least one template to begin.

Editable .gitignore output

Waiting
Select a profile or generate a .gitignore

Rule counts, duplicate diagnostics, and risky-pattern guidance will appear here.

Templates0
Rules0
Duplicates removed0
Warnings0

Diagnostics

Review before committing
Generate a file to see diagnostics.

Rule preview

0 unique rules
RuleTypeOrigin
No rules yet.

Git boundary: .gitignore prevents untracked matching paths from being added but does not remove files already tracked by Git. Use git rm --cached path when a tracked file must start following an ignore rule. Review broad patterns and secret-file rules before committing.

Session history

In-memory only
Generated selections disappear when this page closes.

Paste your .gitignore

Ctrl+Enter to audit

The auditor checks every rule for: duplicate patterns, broad wildcards, lock files that should be tracked, negation ordering risks, potential secret exposure, and missing directory trailing slashes. All analysis is local — nothing is uploaded.

Audit results

Validate mode

Paste your .gitignore content above, then click Audit.

What the auditor checks: duplicate rules (case-insensitive), bare * that ignores everything, negation patterns that depend on rule order, lock files that most projects should track, broad extension wildcards, leading-slash root anchors, patterns that match files that may contain secrets, and patterns without a trailing slash that may unexpectedly match both files and directories.

Why is my .gitignore not working?

The 5 most common causes
1. File is already tracked by Git

A .gitignore rule only affects untracked files. If the file is already committed, Git continues to track it. Fix: git rm --cached path/to/file, then commit, and the ignore rule takes effect going forward.

2. Parent directory is already ignored

Git cannot un-ignore a file inside an ignored directory. If logs/ is ignored, adding !logs/important.log has no effect. You must first un-ignore the directory: !logs/, then re-ignore what you don't want: logs/*.tmp.

3. Wrong .gitignore location

Rules in a .gitignore file apply to the directory it's in and all subdirectories. A rule in src/.gitignore does not affect files at the repository root. Place the file where the pattern scope should start.

4. Pattern doesn't match the path

A pattern like dist (no trailing slash) matches both a file named dist and a directory. A pattern like /dist/ (leading slash) only matches at the repository root. A pattern like dist/ (trailing slash only) matches dist/ at any depth. Test your pattern with git check-ignore -v path.

5. Negation rule overridden or unreachable

Order matters: the last matching pattern wins. If *.log appears after !important.log, all .log files including important.log are ignored. Move the negation rule to after the pattern it should override, and ensure the parent directory is not itself ignored.

Paste your file tree or path list

Ctrl+Enter to simulate
Load sample:

Paste one path per line, or paste the output of the tree command. Tree decorators (├──, └──, ) are stripped automatically. Trailing / marks a path as a directory. Generate your .gitignore on the Build tab first — the simulator reads those rules.

Simulation results

Paste a file tree or list of paths above, then click Simulate.

How the simulator works: It applies your current .gitignore rules in order — last match wins, just like Git. Directory patterns (trailing /) only match directories. Negation patterns (!) un-ignore a previously ignored path. The engine covers *, **, ?, character classes, rooted patterns (/dist/), and negation. It is a browser approximation — always verify with git check-ignore -v path in your repository.

Fetch a .gitignore from the command line

Choose a stack to generate ready-to-run curl, wget, npx, gh CLI, Python, and PowerShell one-liners that fetch a .gitignore directly into your project root.

IDE extensions & plugins

VS Code · JetBrains · Neovim
VS Code — .gitignore Generator extension

The vscode-gitignore-generator extension lets you run Generate .gitignore File from the Command Palette using gitignore.io templates directly inside VS Code.

Install via CLI
code --install-extension piotrpalarz.vscode-gitignore-generator

Also popular: gitignore by CodeZombie — Command Palette → Add gitignore.


JetBrains — .ignore plugin

The .ignore plugin (plugin ID: mobi.hsz.idea.gitignore) works in IntelliJ IDEA, WebStorm, PyCharm, GoLand, Rider, and all JetBrains IDEs. Provides syntax highlighting, auto-completion, template generation, and duplicate-rule detection.

Install (IntelliJ IDEA CLI)
idea installPlugins mobi.hsz.idea.gitignore
Install via UI
Settings → Plugins → Marketplace → search ".ignore"

Neovim — nvim-gitignore

The nvim-gitignore plugin uses Telescope to let you pick templates interactively inside Neovim.

lazy.nvim
{ "gennaro-tedesco/nvim-gitignore" }

CLI tools reference

Install once, use everywhere
npx gitignore (Node.js — no install)

Run npx gitignore node python react — uses gitignore.io, writes .gitignore automatically.

npx gitignore node react vscode macos
gh CLI (GitHub CLI)

Query the GitHub Gitignore Templates API. Append multiple templates with >>.

gh api /gitignore/templates/Node --jq .source > .gitignore
gi shell function (bash / zsh)

Add to .bashrc / .zshrc. Then run gi node,react,vscode > .gitignore.

function gi() { curl -sL "https://www.gitignore.io/api/$*" ;}
PowerShell (Windows)

One-liner to download a template directly into the current directory.

Invoke-WebRequest -Uri "https://www.gitignore.io/api/Node" -OutFile .gitignore

Frequently asked questions

A .gitignore file is a plain-text list of file and directory patterns that Git should ignore when detecting untracked changes. It commonly excludes dependencies, build output, IDE settings, operating-system metadata, local environment files, caches, and generated artifacts from a repository.

A .gitignore Generator combines reusable rules for the technologies and environments in your project, removes duplicate patterns, preserves useful section headers, and returns an editable .gitignore file. This workspace also accepts project-specific rules and reports review items before you copy or download the result.

Choose a stack profile or select templates for languages, frameworks, IDEs, operating systems, and CI. Add custom patterns when needed, choose whether to keep section headers or common secret rules, and select Generate .gitignore. The output remains editable in the browser.

The current browser-only templates include Node.js, Python, Java, PHP, .NET/C#, Go, Rust, Ruby, React/Vite, Next.js, Django, Laravel, Ruby on Rails, and Flutter/Dart. The template list is intentionally visible and editable so you can add project-specific rules when a framework is not listed.

Yes. Select Node.js and React/Vite, or use the Node web app or React + Vite profile. Shared patterns such as node_modules, build output, local environment variants, and logs are deduplicated while the selected template sections remain understandable.

Yes. Select Python, Django, and Visual Studio Code, or use the Django + Python profile. The generated file combines Python caches and environments, Django local database and media patterns, and editor workspace rules without repeating identical entries.

Yes. Templates include Visual Studio Code, JetBrains IDEs such as IntelliJ, WebStorm, and PyCharm, Eclipse, and Sublime Text. These rules help keep workspace metadata and editor-specific project files out of the repository when they are not team-wide source files.

Yes. Operating-system templates cover common macOS Finder files, Windows Explorer and installer artifacts, and Linux temporary or desktop metadata. You can select more than one operating system when a team works across different machines.

Yes. The builder includes Docker, GitHub Actions local files, and Kubernetes local or secret-manifest patterns. These are conservative starter rules; review your deployment workflow so that intentionally versioned manifests, lock files, and shared configuration are not ignored accidentally.

Yes. Enter one pattern or comment per line in Project-specific rules. You can add folders such as secrets/, extensions such as *.local.json, exact files, comments, and negation patterns such as !config.example.json. Custom content is merged locally and remains editable in the output.

Yes. Template rules are merged in a stable category order and duplicate non-comment patterns are removed case-insensitively. The statistics panel reports how many duplicates were removed, while comments and section headers remain available for readability.

Diagnostics identify the number of selected templates, unique rules, removed duplicates, and review warnings. Negation rules receive a review note because their result depends on rule order and parent-directory matching. Secret-file patterns also receive guidance because ignoring a file does not replace secret management.

No. .gitignore affects untracked paths; it does not remove a file that is already in the Git index. If a tracked file should stop being tracked, review it carefully and use a command such as `git rm --cached path/to/file`, then commit the change. Do not use that command blindly on important project files.

Many projects should ignore local environment files, private keys, certificates, credentials, and secret directories. Keep a safe example such as .env.example when the team needs a documented template, and use a dedicated secret manager rather than relying on .gitignore as the only protection.

Yes. The output panel is an editable text area. You can refine patterns, add comments, remove rules that do not apply, normalize spacing, copy the edited content, or download it as a .gitignore file. Review the final file as you would review any source configuration.

Yes. Copy .gitignore, Copy report, and Download .gitignore are available in the workspace. Downloads are generated locally by the browser and the output can be edited before the action is used.

No for the rule set. The generator uses stable category order and deduplicates patterns, so selecting the same templates in a different order produces the same rule content. Section order follows the defined category order rather than click order.

Yes. Template composition, deduplication, diagnostics, editing, copying, and download preparation run in browser memory. The workspace does not upload your source tree, call a remote template API, require an account, write persistent storage, or save the generated file on a server.

No. Templates are practical starting points, not a substitute for repository review. Build tools, deployment systems, generated assets, monorepos, language-specific packaging, and team conventions can require additions or exceptions. Inspect the final output and test Git status before committing.

Yes. The workspace uses responsive category grids, stacked output panels, keyboard-accessible controls, and touch-friendly buttons. For large files, a desktop editor may still be more comfortable for reviewing every rule before committing.

The five most common reasons are: (1) The file is already tracked by Git — .gitignore only affects untracked files, so run `git rm --cached path` and commit. (2) The parent directory is already ignored — Git cannot un-ignore a file inside an ignored directory, so un-ignore the parent first with `!parent/`. (3) The .gitignore is in the wrong directory — rules only apply to the directory and subdirectories where the file lives. (4) The pattern does not match the actual path — use `git check-ignore -v path` to test. (5) A negation rule appears in the wrong order — the last matching rule wins.

Use the Validate tab in ToolsSonic's .gitignore Generator. Paste the contents of your existing .gitignore and click Audit. The auditor checks every rule for duplicate patterns, bare wildcards, negation ordering risks, lock files that should be tracked, potential secret file patterns, and patterns without a trailing slash. Results include line numbers so issues can be fixed immediately. All analysis runs locally in your browser.

Yes. The expanded template library includes Kotlin, Scala, Swift/Xcode, C/C++, R, Elixir, Julia, Dart, and Terraform under Languages, and frameworks including Vue/Nuxt, Angular, Svelte/SvelteKit, NestJS, Astro, FastAPI/Flask, Spring Boot, React Native/Expo, Tauri/Electron, Unity, and WordPress under Frameworks. Use the search box to find any template quickly.

Yes. The Unity template covers Library/, Temp/, Obj/, Build/, Builds/, Logs/, UserSettings/, and related Unity-specific artifacts. Select Unity under Frameworks, combine with your operating system template, and add any CI rules for your build pipeline.

Yes. The Terraform template covers .terraform/, *.tfstate, *.tfstate.*, *.tfvars, crash.log, override files, and .terraformrc. For a full DevOps stack, use the DevOps/K8s profile which combines Docker, Kubernetes, Ansible, and Terraform in one click.

Yes. Angular and Svelte/SvelteKit templates are included under Frameworks. Angular covers /dist/, /out-tsc/, /bazel-out/, .angular/, and coverage/. SvelteKit covers .svelte-kit/, /build/, /package/, and Vite timestamp files. Both can be combined with your IDE and OS templates.

Yes. Vercel and Netlify templates are available under CI & Infrastructure. Vercel covers .vercel/ and deployment artifacts. Netlify covers .netlify/ and functions/node_modules/. These are typically combined with a framework template such as Next.js or SvelteKit.

The Validate mode checks: duplicate rules (case-insensitive), bare `*` wildcards that ignore everything, broad extension patterns like `*.log`, negation rules that depend on rule order, lock files (package-lock.json, Cargo.lock, etc.) that most projects should track, leading-slash root-anchored patterns, patterns that match possible secret files (keys, credentials, tokens), and patterns without a trailing slash that may match both files and directories unexpectedly.

Run `git rm --cached path/to/file` to remove the file from Git's index without deleting it from disk. For a directory, use `git rm -r --cached directory/`. Then add the pattern to .gitignore, stage the .gitignore change, and commit. From that point on, Git will ignore matching untracked files.

Yes. Run `git check-ignore -v path/to/file` to see which .gitignore rule (if any) is matching a specific path. The output shows the file, line number, and pattern that matched. If the command returns nothing, no rule is currently ignoring the path. This is the most reliable way to diagnose why a pattern is not working as expected.

What is .gitignore Generator?

What Is a .gitignore File? (And Why Does It Matter?)

A .gitignore file is a plain-text configuration file that Git reads from the root of a repository (and from any subdirectory) to decide which untracked files and directories to leave untracked — permanently keeping them out of version control history. Without a well-constructed .gitignore, accidental commits of node_modules/, compiled build artifacts, IDE project settings, OS metadata files like .DS_Store and Thumbs.db, secrets like .env and API key files, and coverage reports become a permanent part of your repository history and can expose sensitive data to anyone who clones the repo.

.gitignore Pattern Syntax — Complete Reference

Every line in a .gitignore file is either a blank line (ignored), a comment starting with #, or a pattern. Patterns follow a set of rules that differ from standard shell glob syntax in important ways.

Basic file and directory matching. A pattern like *.log matches any file ending in .log in any directory in the repository. A pattern like build/ (trailing slash) matches a directory named build at any depth and ignores its entire contents. A pattern like /build/ (leading slash) anchors to the repository root, so it only matches a build/ directory at the top level, not in subdirectories.

Double-star glob. /logs matches a directory named logs anywhere in the tree. logs/ matches everything inside a top-level logs directory. a/**/b matches a/b, a/x/b, a/x/y/b, and any further nesting. This is the most powerful pattern and is not the same as two consecutive * characters in a shell.

Negation patterns. A pattern beginning with ! un-ignores a previously ignored path. Order matters: the last matching pattern wins. This means *.log followed by !important.log would ignore all log files except important.log. However, Git cannot un-ignore a file inside an already-ignored directory — you must un-ignore the directory first with !logs/, then re-ignore what you want with logs/*.tmp.

Character classes and ranges. Square brackets work the same as in most glob implementations: [abc] matches any single character from the set; [0-9] matches any digit; [!0-9] matches any character that is not a digit.

Trailing space escaping. Trailing spaces are ignored unless escaped with a backslash: \ (backslash followed by a space) preserves a trailing space in a pattern, which is rarely needed but defined.

How ToolsSonic's .gitignore Generator Works

ToolsSonic's .gitignore Generator is a fully browser-local tool that lets you combine multiple official templates, apply one-click profiles for common project types, add custom rules, choose deduplication and ordering options, validate each pattern against known bad practices, preview which files a pattern would match in a sample tree, copy the output, and download a ready-to-use .gitignore file — all without uploading your repository or contacting any external API.

Template groups and profiles. The generator ships with templates grouped into five categories: Languages (Node.js, Python, Java, PHP, Ruby, Go, Rust, C#, C++, Swift, Kotlin, Dart/Flutter), Frameworks & Build Tools (React/Next.js, Vue/Nuxt, Vite, Laravel, Django, Rails, Spring Boot, Docker, Kubernetes, GitHub Actions), IDEs & Editors (VS Code, IntelliJ IDEA, PyCharm, WebStorm, Eclipse, Xcode), Operating Systems (macOS, Windows, Linux), and Security & Secrets (dotenv, API keys, private keys, SSH). Six pre-built profiles — Full Stack Web, Python Data Science, Mobile Flutter/Dart, DevOps/Docker, Rust Systems, and Minimal Universal — select a curated set of templates in one click.

Merge options. Smart Merge deduplicates rules, sorts them alphabetically within sections, and keeps only the first occurrence of any duplicate. Append mode stacks templates in order without modification. The generator also supports stable sort (preserving insertion order for non-duplicate rules) and a group headers toggle that adds comment section labels like # Node.js to the output.

Diagnostics. Every custom rule and merged rule is checked for common mistakes: broad wildcards, negation patterns that depend on rule order, missing trailing slashes on directory-only patterns, and potential secret file patterns.

Why Is My .gitignore Not Working?

This is one of the most-searched git questions, with thousands of monthly queries. The five root causes are:

1. File already tracked. A .gitignore rule only affects untracked files. If node_modules/ or .env was committed before the rule was added, Git continues tracking it. Fix: git rm --cached path, then commit.

2. Parent directory ignored. Git cannot un-ignore a file inside an already-ignored directory. !logs/important.log has no effect if logs/ is ignored. Un-ignore the directory first: !logs/, then re-ignore: logs/*.tmp.

3. Wrong .gitignore location. Rules apply to the directory they live in. A rule in src/.gitignore does not cover files at the repository root.

4. Pattern doesn't match the path. Use git check-ignore -v path to test rules against specific paths. Remember: trailing slash = directory only, leading slash = root-anchored, no slash = matches anywhere.

5. Negation in wrong order. The last matching rule wins. *.log after !important.log cancels the negation. Move the negation rule after the wildcard it should override.

ToolsSonic's Validate tab audits any existing .gitignore against all five of these patterns, flagging issues with line numbers.

Common use cases

  • Generating a .gitignore for a Node.js + React + VS Code project in one click using the Node web app profile
  • Auditing an existing .gitignore to find duplicate rules, broad wildcards, and negation-order risks
  • Combining Python + Django + VS Code + Linux templates into a single deduplicated file
  • Diagnosing why a .gitignore is not ignoring files — the Validate mode flags tracked-file and negation-order scenarios
  • Adding custom patterns for project-specific secrets, build outputs, or local override files
  • Generating a monorepo .gitignore covering Node.js + Python + Go + Docker in one file
  • Creating a React Native + Expo .gitignore including iOS and Android build artifacts and signing keys
  • Generating a DevOps .gitignore for Terraform + Kubernetes + Ansible without leaking tfstate or vault passwords
  • Replacing gitignore.io without leaving the browser or making an API call

Why use ToolsSonic's .gitignore Generator?

ToolsSonic's .gitignore Generator processes everything in browser memory — no repository files are uploaded, no patterns are sent to a remote API, and no account is required. It is the only browser-based generator that combines 82 templates, 12 one-click profiles, smart deduplication with feedback, inline diagnostics, a Validate mode for auditing existing files, a rule preview table with origin tracking, session history, and dark mode in one focused workspace.

Competitor research confirms gitignore.io is the dominant tool for template lookups but has no diagnostics, no validate mode, no profile presets, and no custom rule management. The ToolsSonic generator addresses all these gaps while keeping every operation strictly local.

.gitignore Pattern Syntax Quick Reference

PatternMeaningExample match
*.logAll files ending in .log, anywhere in the treeerror.log, logs/app.log
build/Directory named build at any depthbuild/, src/build/
/build/Directory named build only at repository rootbuild/ only
!important.logUn-ignore a previously ignored fileKeeps important.log tracked
**/logsDirectory named logs anywhere in the treelogs/, src/logs/, a/b/logs/
logs/**Everything inside a top-level logs directorylogs/app.log, logs/sub/x
a/**/bb nested inside a at any deptha/b, a/x/b, a/x/y/b
[abc].txta.txt, b.txt, or c.txta.txt, b.txt
[0-9].txtAny single-digit filename .txt1.txt, 9.txt
.envExact filename match anywhere in the tree.env, config/.env
.env.*.env with any extension.env.local, .env.production
node_modules/node_modules directory at any depthnode_modules/, packages/app/node_modules/
# commentComment line, ignored by Git
blank lineIgnored by Git

Negation restriction. You cannot un-ignore a file that lives inside an already-ignored directory. If logs/ is ignored, adding !logs/important.log has no effect. You must first un-ignore the directory with !logs/, then re-ignore what you want with logs/*.tmp. ToolsSonic's diagnostics warn when a negation pattern targets a path inside an ignored directory.

Already-tracked files. A .gitignore entry does not affect files that are already tracked. To stop tracking a file that is already committed, run git rm --cached <file> first, then commit the removal, and the .gitignore entry will prevent future re-tracking.

How ToolsSonic Beats Every .gitignore Generator Competitor

Featuregitignore.ioGitHub Template PickerGit TowerDevToolsDailyToolsSonic
Template count~570~175~80~5082 curated (all major stacks)
Validate / audit modePaste & audit any .gitignore
One-click profiles12 profiles
Deduplication with feedback✅ Count shown
Custom rules UI✅ With negation validation
Per-rule origin table✅ Rule / Type / Origin
Browser-local (no server)partial✅ 100% local
Dark mode
Session history + Reuse✅ 8 entries
REST API

The validate gap. No other browser-based .gitignore tool offers an audit mode. The "gitignore not working" search cluster receives thousands of monthly searches with weak SERP competition. ToolsSonic's Validate tab directly addresses this need, making it the only tool that both generates and audits .gitignore files. Paste any existing .gitignore and get line-numbered feedback on duplicate rules, broad wildcards, negation-order risks, lock files that should be tracked, and potential secret file patterns.

100% private — runs in your browser Instant — no server round-trip Free forever — no account needed