.gitignore Generator
Generate .gitignore files from 50+ templates for popular languages, frameworks, IDEs, and tools. Merge multiple templates, add custom rules, and download. 100% client-side — no data leaves your browser.
Select Technologies
Search and select the technologies used in your project. Templates are merged and deduplicated automatically.
Custom Rules
Add your own patterns below (one per line). These will be appended under a "Custom" section.
Generated .gitignore
About .gitignore Files
A .gitignore file tells Git which files and directories to ignore when tracking changes in a repository. It is one of the first files you should create when starting any new project. Without a properly configured .gitignore, your repository may accumulate build artifacts, dependency directories, environment files containing secrets, IDE configuration files, and operating system metadata that bloat the repository, leak sensitive information, and create merge conflicts between team members using different tools.
Why .gitignore Matters
Version control systems work best when they track only source code and essential configuration. Build outputs like compiled binaries, bundled JavaScript, and generated documentation can be reproduced from source and should not be committed. Dependency directories like node_modules/ (Node.js), vendor/ (PHP/Go), venv/ (Python), and target/ (Rust/Java) can contain tens of thousands of files and hundreds of megabytes that are easily restored with a single command. Environment files (.env) often contain database credentials, API keys, and other secrets that must never appear in version history.
Pattern Syntax
Gitignore patterns follow specific rules. A leading slash / anchors the pattern to the repository root. A trailing slash / matches only directories. An asterisk * matches any sequence of characters except slashes. A double asterisk ** matches any number of directories. A question mark ? matches any single character. Lines starting with # are comments. A leading exclamation mark ! negates the pattern, allowing you to re-include a file that would otherwise be ignored. For example, *.log ignores all log files, !important.log re-includes a specific one, and build/ ignores the entire build directory.
Global vs Local .gitignore
A .gitignore file in the repository root applies to the entire project and is shared with all collaborators. You can also place .gitignore files in subdirectories for directory-specific rules. For personal preferences that should not be shared (like your IDE settings), use a global gitignore file configured via git config --global core.excludesFile ~/.gitignore_global. This keeps your personal tool preferences out of the shared project configuration.
Common Mistakes
The most common mistake is adding .gitignore rules after files have already been committed. Git continues to track files that were committed before the ignore rule was added. To fix this, you must explicitly remove them from tracking with git rm --cached filename. Another common error is ignoring too broadly (using patterns like *) or not broadly enough (missing OS-specific files like .DS_Store on macOS or Thumbs.db on Windows). This generator helps avoid both problems by providing comprehensive, battle-tested templates.
Security Considerations
A well-configured .gitignore is a critical security measure. Files like .env, *.pem, *.key, credentials.json, and .aws/ should always be ignored to prevent accidental exposure of secrets. Even if you delete a file from a later commit, its contents remain in the Git history and can be recovered. If secrets are accidentally committed, they should be considered compromised and rotated immediately, regardless of whether the repository is public or private.
100% Client-Side Processing
This generator runs entirely in your browser. All 50+ templates are embedded in the page, and merging, deduplication, and preview generation happen locally using JavaScript. No project information or custom rules are transmitted to any server. You can use this tool offline after the page has loaded.