DevPik Logo

Gitignore Generator

Build a .gitignore file by selecting languages, frameworks, IDEs, and OSes. Combines patterns, deduplicates, and downloads instantly.

Why Use Gitignore Generator?

Most teams write .gitignore by copy-pasting from the last project, and that's exactly how secrets and 200MB node_modules folders end up in public repositories. This tool combines the canonical github/gitignore templates for every language, framework, IDE, and OS in your stack, deduplicates the patterns, and orders them sensibly (OS files first so they're easy to find). It also includes patterns most hand-written .gitignores miss — like `.terraform.lock.hcl`, the JetBrains modules.xml gotcha, and the `!.vscode/settings.json` negation pattern that lets you share workspace settings without leaking user state. Run it once at project start and your repo stays clean.

How to Use Gitignore Generator

  1. Click a quick preset (Web Project, Next.js Project, Python Project, Java Project, Full Stack) to select a common stack in one click.
  2. Or pick templates manually — search for technologies (e.g. 'python', 'docker') and click to toggle. Each adds its standard .gitignore patterns.
  3. Add custom patterns in the box at the bottom-left (one rule per line). These get appended under a # Custom section.
  4. The .gitignore output updates live, deduplicated and ordered: OS files first, then IDEs, tools, frameworks, and languages.
  5. Click Copy or Download to save the file as `.gitignore` in your project root.

Worked Examples

Next.js + TypeScript starter

Input
Select: Node, Next.js, TypeScript, VS Code, macOS, Windows
Output
# macOS
.DS_Store
._*

# Windows
Thumbs.db
Desktop.ini

# VS Code
.vscode/*
!.vscode/settings.json

# Node.js
node_modules/
.env*.local

# Next.js
.next/
out/
.vercel

# TypeScript
*.tsbuildinfo

Patterns dedupe across templates — `.env*.local` only appears once even though Node and Next.js both list it.

Python data-science project

Input
Select: Python, VS Code, macOS
Output
# macOS
.DS_Store

# VS Code
.vscode/*
!.vscode/settings.json

# Python
__pycache__/
*.py[cod]
.venv/
.pytest_cache/
.mypy_cache/
.ipynb_checkpoints

Includes `.ipynb_checkpoints` for Jupyter notebooks — easy to forget if you write the file by hand.

Adding custom rules

Input
Custom rules box: secrets/
*.local
local_config.json
Output
### Custom ###
secrets/
*.local
local_config.json

Custom rules go into their own section at the bottom so they're easy to spot and edit later.

About Gitignore Generator

A .gitignore file tells Git which files and folders to ignore — usually build artifacts, dependency directories, environment files, OS metadata, and editor-specific files. Getting it right matters: a missing .gitignore is the #1 reason credentials, .env files, and 200MB node_modules folders end up in public repos. Building one by hand means cross-referencing the standard patterns for each language, framework, IDE, and operating system on your machine — tedious and easy to miss things. The DevPik Gitignore Generator combines battle-tested templates from the github/gitignore reference repo into one combined file. Pick the technologies in your stack, the IDEs your team uses, and the operating systems you develop on, and the tool produces a clean, deduplicated .gitignore with comment headers grouping each section. Run it once when you start a project — well before your first commit — and you'll never accidentally commit a .DS_Store or an .env again. The whole tool runs client-side; the templates are bundled in the JavaScript, so it works offline once the page loads.

Troubleshooting & Common Issues

I added .gitignore but Git is still tracking my ignored files

.gitignore only ignores files that are not yet tracked. If you committed a file before adding it to .gitignore, you need to remove it from the index: `git rm --cached <file>` (use `-r` for a directory). After that, future changes to the file will be ignored. Be careful — `git rm --cached` does not delete the file from your working directory but does delete it from any future clones.

My .env file got committed before I added .gitignore — what now?

First, rotate any secrets in that file immediately (assume they're public the moment they hit the remote). Then `git rm --cached .env`, add `.env` to .gitignore, and commit. To remove the file from git history (so it's not in old commits), use `git filter-repo` or BFG Repo-Cleaner — and force-push, which destroys collaborator history. For public repos with leaked secrets, the rotation is more important than the history scrub.

I want to share my VS Code workspace settings but ignore everything else under .vscode

That's exactly what the VS Code template does. The pattern `.vscode/*` ignores everything in .vscode, then `!.vscode/settings.json` (and similar lines) un-ignores specific files. The order matters — the un-ignore lines must come AFTER the ignore line. Don't reorder them manually.

Patterns from one section conflict with another (e.g. dist/ in both Node and Vite)

The generator deduplicates patterns automatically — `dist/` will appear only once even if multiple selected templates list it. Comment headers and blank lines are kept for readability, but the actual ignore patterns are unique.

Frequently Asked Questions

What is a .gitignore file?

A .gitignore file lists patterns of files and folders that Git should not track. Place one in the root of your repository (and optionally in subdirectories) and Git will skip the matching files when staging, committing, and showing status. It's the standard way to keep build artifacts, dependency folders, environment files, and OS junk out of your repo.

Where do I put the .gitignore file?

The most common location is the root of your repository — patterns there apply to the whole repo. You can also put a .gitignore in any subdirectory; patterns are then relative to that directory. For monorepos, a root .gitignore plus per-package .gitignore files is typical. Always commit the .gitignore itself so collaborators get the same rules.

What's the difference between .gitignore and .git/info/exclude?

.gitignore is committed to the repo and shared with everyone. .git/info/exclude is local to your clone — it lets you ignore files just for yourself without imposing your preferences on the team. Use .git/info/exclude for personal editor configs, scratch notes, or local debug logs that don't make sense for everyone to ignore.

Should I commit my .gitignore file?

Yes — always. The whole point is that your collaborators and CI pipeline get the same ignore rules you do. The only exception is .git/info/exclude, which is intentionally local-only.

How do I ignore a file that's already been committed?

Adding it to .gitignore alone doesn't work — Git only ignores untracked files. Run `git rm --cached <file>` to stop tracking it (without deleting it locally), then commit. From that point on, the file is ignored.

What does the ! pattern mean in .gitignore?

An exclamation mark un-ignores a previously ignored file. The classic pattern is to ignore everything in a directory (e.g. `.vscode/*`) then un-ignore specific files you want to share (e.g. `!.vscode/settings.json`). Order matters: the negation must come after the ignore rule.

Can I use wildcards in .gitignore?

Yes. `*` matches anything except `/`, `?` matches a single character, `**` matches any number of directories, `[abc]` matches one of a set, and a trailing `/` restricts the match to directories. For example, `**/build/` ignores any folder named `build` at any depth.

How is this generator different from gitignore.io?

Functionally similar — both combine templates for languages, frameworks, and OSes. DevPik runs 100% client-side (templates bundled in JS), shows a live deduplicated preview, has comment headers grouped by section, sorts in OS → IDE → Tools → Frameworks → Languages order so the most common 'noise' patterns appear first, and adds a Custom section at the bottom for project-specific rules. No tracking, no API call.

Related Tools

Was this tool helpful?