.gitignore Generator
Select any combination of languages, frameworks, and editors. The merged .gitignore updates instantly. Copy or download with one click — 100% browser-side, nothing uploaded.
← Pick a language or framework on the left to start.
How to use
- Search or scroll the list on the left to find your language, framework, or editor.
- Check the boxes for each technology in your project. The preview updates instantly and duplicate patterns are deduplicated automatically.
- Copy or download the merged .gitignore, then place the file in your repository root and commit it.
Frequently asked questions
What is a .gitignore file?
A .gitignore file tells Git which files and directories to ignore in a project. When you run git status, git add, or git commit, Git reads .gitignore and skips paths that match the patterns inside. This prevents build artifacts, local config files, secrets, log files, and OS noise from being accidentally committed.
How do I create a .gitignore file?
Create a plain text file named .gitignore (no extension) in the root of your repository. Use this generator: select your stack, then copy or download the result. You can also run touch .gitignore in your terminal and add patterns manually. The file must be in the repository root (the directory containing .git/) to apply globally.
Can I combine multiple language templates?
Yes — real projects always combine several. A Node.js project on macOS using VS Code would combine Node.js + macOS + VS Code templates. This generator lets you select any number of templates and merges them instantly, deduplicating identical patterns so the output stays clean.
What pattern syntax does .gitignore support?
A blank line matches nothing. Lines starting with # are comments. Trailing / matches only directories. Leading / anchors a pattern to the repository root. * matches anything except /. ** matches across directory boundaries. Leading ! negates a pattern — it un-ignores a file that was previously matched by an earlier rule.
Does .gitignore affect files already tracked by Git?
No. .gitignore only prevents untracked files from being staged. If a file is already tracked, adding it to .gitignore will not make Git stop watching it. To untrack a committed file without deleting it: run git rm --cached <filename>, add the pattern to .gitignore, and commit both changes.
What is the difference between .gitignore and .gitkeep?
.gitignore tells Git to skip specified files. .gitkeep is a community convention (not a Git feature) — an empty placeholder file committed inside an otherwise-empty directory so that the directory gets tracked. Git does not track empty directories natively. The placeholder can be named anything; .gitkeep is just self-documenting.
Should I commit .gitignore to my repository?
Yes. Commit it so all collaborators share the same ignore rules. For IDE-specific patterns (.idea/, .vscode/, .DS_Store), consider a global .gitignore instead: run git config --global core.excludesFile ~/.gitignore_global and add those patterns there. They’ll apply to every repo on your machine without cluttering project .gitignore files.
How do I un-track a file that is already tracked?
Run git rm --cached <file> to remove it from Git’s index without deleting it from disk. For a directory: git rm -r --cached <directory>. Then add the pattern to .gitignore and commit both the removal and the .gitignore update together. After that, Git treats the file as untracked.
What is a global .gitignore file?
A global .gitignore applies to every repository on your machine. Set it up with git config --global core.excludesFile ~/.gitignore_global and add patterns to that file. It’s ideal for OS artifacts (.DS_Store, Thumbs.db) and editor files (.idea/, .vscode/) that you never want tracked but don’t want in every project’s .gitignore.
Why is my .gitignore not working?
The most common reason: the file is already tracked by Git. Run git check-ignore -v <filename> to diagnose — if no output appears, no rule is matching. Double-check your pattern syntax. Verify the .gitignore file is saved in the correct directory (the repo root, alongside .git/). If the file was previously committed, run git rm --cached <file> first.
Examples
Node.js + macOS + VS Code
Typical JS developer setup on macOS. Check all three boxes to combine.
# Node.js node_modules/ npm-debug.log* .env dist/ build/ coverage/ # macOS .DS_Store .AppleDouble ._* # VS Code .vscode/ *.code-workspace
Python + Django + Docker
Django web app running in Docker containers.
# Python __pycache__/ *.pyc .venv/ .env # Django *.log local_settings.py db.sqlite3 media/ staticfiles/ # Docker .docker/ docker-compose.override.yml
Java + Spring + Maven
Java Spring Boot project built with Maven.
# Java *.class *.jar *.war target/ .settings/ # Spring spring-shell.log *.log # Maven dependency-reduced-pom.xml buildNumber.properties
About this .gitignore generator
This tool assembles .gitignore files from 40 hand-curated templates covering the most commonly-searched languages, frameworks, build systems, editors, and operating systems. Every pattern was selected because it matches a file type that causes genuine pain when accidentally committed to a repository.
There are four categories of files worth ignoring in almost every project:
- Build artifacts — compiled classes (
*.class), bundled JavaScript (dist/), transpiled output, and cached files. These change on every build, creating noisy diffs and merge conflicts with zero benefit. - Environment-specific files —
.envfiles, local database configs, editor workspaces. These vary per developer machine. More critically,.envfiles often contain API keys, database passwords, and secrets. Committing them is a security incident waiting to happen. - Package manager dependencies —
node_modules/,vendor/,target/. Dependencies are declared in manifest files (package.json,Cargo.toml,go.mod). Any collaborator can restore them with a single install command. Committing them inflates repository size and makes clones slow. - OS and editor noise —
.DS_Store(macOS Finder metadata),Thumbs.db(Windows thumbnail cache),.idea/(JetBrains files),.vscode/(VS Code workspace settings). These are machine-specific artifacts with no relevance to the project code.
Privacy claim. This tool runs 100% in your browser. Template assembly happens in local JavaScript — no selections are transmitted to any server. Verify by opening DevTools → Network and checking or unchecking templates: you will see zero outbound requests from the tool itself. The only external request on the page is the Cloudflare Web Analytics beacon, which counts page views anonymously.
The tool works offline. Once the page has loaded, you can disconnect from the internet, select templates, and download your .gitignore — all functionality continues to work. Templates are embedded directly in the page as JavaScript constants with no dependency on any external API. If any upstream service goes down, this tool is unaffected.
If you need a pattern this tool does not include, add it manually to the downloaded file in any text editor. The output is plain text, one pattern per line. Community resources like the github/gitignore repository contain the full set of official templates for more specialized needs.