.gitignore Generator

Tick the languages, operating systems and editors your project uses and get one combined .gitignore, with duplicate rules dropped automatically.

🌐 Español

🔒 Private by design: everything is generated locally in your browser and never uploaded to any server.

A .gitignore is three unrelated lists in one file

Hardly anyone’s ignore file is about one thing. There is the language or runtime, which drops build output and dependency folders into the working tree. There is the operating system, which sprinkles its own metadata wherever you happen to open a folder. And there is the editor, which keeps per-project state right next to your code. Three lists, three origins, usually assembled from memory once and never looked at again.

That is why this page is a column of tick boxes instead of a text field. You describe the machine and the project, and the generator writes those separate lists out as one file with a labelled section for each. Node.js, macOS and VS Code are ticked when the page loads, which covers a very common setup, but they are only a starting position.

Ticking the boxes and reading what comes back

  1. Tick every box that applies. The labels name what each template covers, so Node.js (node_modules, npm/yarn logs, .env, dist/build) and Rust (/target, rustfmt backups, debug symbols) tell you the shape of the section before you generate anything.
  2. Click the action button, which carries this page’s own name, .gitignore Generator.
  3. Read the result in the box that replaces the form. Each template you ticked appears as its own commented section.
  4. Click Copy to clipboard, paste into a new file called .gitignore at the root of the repository, and commit it.
  5. Click Generate more to bring the boxes back and try a different combination.

There is no download step, and there is nothing to fetch either, so the text appears the moment you click. Untick everything and the box comes back with a single comment line asking you to tick at least one template and run it again, which is friendlier than handing you a blank file.

Curated patterns, not a live mirror of github/gitignore

The templates are hand-written into the page, covering Node.js, Python, Java, Go, Rust, macOS, Windows, Linux, VS Code, IntelliJ IDEA and Vim. Each one is a high-confidence subset of the patterns that ecosystem’s standard file is famous for, and the honest framing matters here: this is not a byte-for-byte copy of GitHub’s own github/gitignore repository, and it does not update when that repository does. It cannot, because there is no network call behind the button.

For most projects that gap does not matter, since the patterns everyone actually relies on have been stable for years. When you need one ecosystem’s exact current file, go to the source repository and take it whole. When you need a sensible combination of five ecosystems in one file in a single pass, this is faster.

What the dedupe pass removes, and the empty headers it leaves

Sections are written in a fixed order, and any real ignore pattern that has already appeared is skipped the second time. Tick Java and IntelliJ IDEA together and out/ appears once, under Java, because the Java section was written first. Tick Node.js and Python together and Python loses its build/, dist/ and .env lines for the same reason.

Comments are treated differently on purpose: they are section labels, not rules, so two templates using the same wording both keep theirs. That has one visible consequence worth knowing about. If a template’s only pattern under a heading was already claimed by an earlier section, the heading survives with nothing beneath it. Python’s environment-file heading does exactly that when Node.js is also ticked. The file is still correct, and the orphaned comment is one keystroke to delete.

Committing it, and the trap of files Git already tracks

An ignore rule is not a delete. Git applies it only to files it is not already tracking, so adding .env to the file does nothing at all if .env was committed last month. That is the single most common surprise around this file, and the fix is to remove the path from the index and commit that removal before the new rule has any effect. For anything secret, assume it is compromised the moment it reaches a shared branch, because history keeps it.

The other habit worth forming is checking the diff. Regenerating a baseline for an old, drifted file is a good idea, but the project-specific lines somebody added over the years are exactly the ones you cannot afford to lose. Paste the old file and the new one into the Text Diff Checker and merge deliberately rather than overwriting.

Where .gitignore stops and .dockerignore begins

These two files look alike and answer different questions. This one decides what Git records; a .dockerignore decides what gets sent to the Docker daemon as build context, which is a size and cache concern rather than a history one. The Dockerfile Generator produces that second file, selected through its “Which file to show” dropdown, and its Node.js output covers .git, node_modules/, .env and a handful of build directories independently of anything you tick here.

New repositories tend to need a few of these at once, so it is worth knowing what else is nearby. The Nginx & .htaccess Config Generator builds the server rules, the README Generator handles the front door, and the rest of the developer tools category covers formatting, hashing and encoding. The complete developer tools guide walks through how they fit together.

One implementation note, since it explains an oddity you may notice: the module hands the shell a file named .gitignore, but the generator shell only ever reads that file’s text into the result box. The name never reaches you. It is dead weight, kept because every tool on this site returns the same shape, and it is dead precisely because the generator layout offers a copy button and no download path for that name to end up on.

See it in action

Screenshot of the .gitignore Generator tool with Node.js (node_modules, npm/yarn logs, .env, dist/build) set to on, Python (__pycache__, venv, .egg-info, pytest/mypy caches) set to off
.gitignore Generator mid-process: Node.js (node_modules, npm/yarn logs, .env, dist/build) set to on, Python (__pycache__, venv, .egg-info, pytest/mypy caches) set to off.
Screenshot of the .gitignore Generator result screen showing the generated output “# Node.js # Dependencies node_modules/ .pnp.* # …”
The finished result: the generated output “# Node.js # Dependencies node_modules/ .pnp.* # …”. The download link is a local blob URL — the file never leaves your device.

Frequently asked questions

Which templates are already ticked when the page first loads?

Node.js, macOS and VS Code start ticked and every other box starts empty. That combination is a bet on the most common visitor, someone on a Mac writing JavaScript in VS Code, and it is only a starting point. Untick anything that does not apply and tick whatever else you need before running it.

Is there a download button, or only a copy button?

Only a copy button. When the run finishes you get a read-only text box, a Copy to clipboard button and a second button that clears the result and brings the tick boxes back. Nothing is written to your downloads folder, so paste the text into a new file yourself and save it as .gitignore in the repository root.

One of my sections has a heading with nothing underneath it. Is the output broken?

No, that is a visible side effect of the merge and it is harmless. Only real pattern lines are compared across sections; comment lines are always kept exactly as their own template wrote them. Tick Node.js and Python together and Python's environment-file heading survives while the single pattern under it does not, because the Node.js section already claimed that pattern. Delete the stray heading if it bothers you.

Does the order I tick the boxes change the order of the sections?

No. The generator walks its own fixed list and always emits sections in that order, so Node.js comes before Python, the operating systems come after the languages, and the editors come last. Ticking Vim first and Node.js second produces exactly the same file as ticking them the other way round.

Will a rule from this file stop Git tracking something I already committed?

No, and this catches people out constantly. Ignore rules only apply to files Git is not already tracking, so adding a line for a file that is already in the index changes nothing. Remove it from the index first with a cached removal, then commit that change. If the file held a secret, treat the secret as leaked and rotate it, because it stays in the repository history regardless.

My framework or language is not in the list. What is the closest starting point?

Tick the nearest language plus your operating system and editor, then paste the extra lines in by hand. The patterns here are a curated, offline subset written into the page, not a live copy of anything, so GitHub's own github/gitignore repository remains the place to look up one ecosystem's full and current file. Merging a few lines from there into this output is usually a one-minute job.

Related tools