How to use .gitignore Generator
The .gitignore Generator assembles a clean, deduplicated .gitignore file for any combination of languages, frameworks, editors, and operating systems — drawing from the same community-maintained templates used by GitHub's official generator. Select your stack and instantly get a file that excludes build artifacts, dependency directories, IDE settings, OS metadata, and log files, keeping your repository free of accidental noise.
- Type or select the languages and frameworks your project uses (e.g. Node, Python, Java, Go, React).
- Add any editors or IDEs on your team (VS Code, JetBrains IDEs, Vim, Emacs).
- Add operating systems if your team is cross-platform (macOS, Windows, Linux).
- Review the combined output — duplicate patterns are automatically removed.
- Copy the generated .gitignore content or download it as a .gitignore file.
- Place the file in your repository root and commit it as the first commit before adding any source files.
Your data never leaves your device — 100% private processing.
.gitignore pattern syntax
Gitignore patterns follow glob rules with a few extensions. A leading slash anchors the pattern to the repository root (e.g. /dist/ ignores only the top-level dist directory). A trailing slash matches only directories. An asterisk (*) matches anything except a slash; double asterisk (**) matches across directory separators (e.g. **/node_modules ignores node_modules at any depth). A leading exclamation mark (!) negates the pattern, re-including a file that was excluded by a previous rule. Blank lines and lines beginning with # are ignored as comments. Patterns are read top-to-bottom and the last matching rule wins for a given file.
| Pattern | What it ignores | Use case |
|---|---|---|
| node_modules/ | Any node_modules directory at any depth | Node.js projects |
| *.log | All files ending in .log | Application logs |
| .env | The .env file in the root | Secret environment variables |
| .env*.local | .env.development.local etc. | Local environment overrides |
| dist/ | Top-level dist build directory | Compiled output |
| **/__pycache__/ | Python bytecode cache directories | Python projects |
| !.env.example | Re-includes .env.example | Sharing env templates |
Global gitignore and repository-level ignore
Git supports three layers of ignore rules. The repository-level .gitignore file is the most common and should contain project-specific patterns. A global gitignore (~/.gitignore_global, configured via git config --global core.excludesfile) applies to all repositories on your machine and is the right place for editor and OS patterns (e.g. .DS_Store, Thumbs.db, .idea/). The .git/info/exclude file applies to your local clone without being committed. Already-tracked files are not ignored even if a pattern matches — you must run git rm --cached <file> to stop tracking them.
Worked examples
Ignore Node build output
Inputs: stack: Node
Result: node_modules/, dist/, .env, *.log, npm-debug.log*
Re-include one file
Inputs: *.log then !important.log
Result: ignores all .log files except important.log
Ignore at any depth
Inputs: **/__pycache__/
Result: matches __pycache__ in every directory
Glossary
- .gitignore
- A text file that specifies intentionally untracked files that Git should ignore.
- Glob pattern
- A wildcard pattern using *, ?, and ** to match file paths without a full regular expression.
- Negation pattern
- A .gitignore pattern starting with ! that re-includes a file previously excluded by an earlier rule.
- Tracked file
- A file that has been added to Git's index — gitignore rules do not affect files that are already tracked.
- git rm --cached
- A git command that removes a file from the index (stops tracking it) without deleting it from disk.
Related reading
Frequently Asked Questions
Why use .gitignore Generator?
- Generate a combined .gitignore from community-maintained templates for any language or framework
- Automatically deduplicate patterns when combining multiple language and tool templates
- Include editor-specific patterns (VS Code, JetBrains, Vim) to keep IDE files out of git
- Add OS-level patterns (.DS_Store, Thumbs.db) for cross-platform development teams
Common use cases
- Bootstrap a Node.js project with a .gitignore that excludes node_modules and .env files
- Add Python and Docker patterns to an existing project after adding containerised services
- Generate a JetBrains-aware .gitignore before onboarding developers using IntelliJ IDEA
- Exclude compiled .class files and Maven target/ directories from a Java repository
- Combine Next.js, TypeScript, and macOS templates into one clean .gitignore for a monorepo
Get weekly tool tips & updates
New tools, power-user tips, and productivity hacks — delivered free every Friday.
No spam, ever. Unsubscribe with one click.
Related Developer Tools
robots.txt Generator
Generate a robots.txt file for your website. Set user-agents, allow/disallow rules, crawl-delay, and sitemap URL. Free, private robots.txt builder.
.htaccess Redirect Generator
Generate .htaccess redirect rules online. Create 301/302 redirects, www and HTTPS forcing, and RewriteRule snippets for Apache. Free and private.
Slug Generator
Convert any text or title into a clean URL slug. Lowercases, removes accents and special characters, and joins words with hyphens. Free slugify tool.
cURL Converter
Convert a curl command to JavaScript fetch, Node, Python requests, or PHP. Paste your curl and get clean client code instantly. Free and private.
Cron Expression Generator
Build and decode cron expressions online. Get a plain-English description of any crontab schedule and a field-by-field breakdown. Free cron generator.
JSON Formatter & Validator
Format, validate, and minify JSON instantly. Includes syntax highlighting, error detection, and a collapsible tree view — free, private, in-browser.
Explore all Developer Tools.