Gitignore Generator

Lines in file—
Stacks included—
Characters—

How Gitignore Generator is calculated: Tick your stacks; the generator joins the standard community templates for each one under a heading comment, with a blank line between sections. Templates are standard patterns, built in your browser.

What is a gitignore generator?

A gitignore generator builds a .gitignore file — the list that tells Git which files to leave out of version control. Tick the stacks your project uses, press the button, and the file appears, ready to copy or download. The default ticks Node, Python, macOS, and VS Code, and produces a 37-line file with 4 sections and 380 characters.

Every project has files that should never be committed. Node projects have node_modules, a folder that can hold tens of thousands of files and is rebuilt with one command. Python projects have __pycache__ and virtual environments. Every machine adds its own clutter: .DS_Store on a Mac, Thumbs.db on Windows, editor settings in .vscode and .idea. A .gitignore file keeps all of that out of the repository.

This generator covers the stacks people actually use: Node, Python, Java, Flutter, .NET, Go, Rust, macOS, Windows, VS Code, and IntelliJ. Each one adds its own section of standard patterns, with a heading comment so you can see which lines came from where. Everything runs in your browser — nothing is uploaded, nothing is stored, and there is no account to create.

The templates are standard community patterns — the same entries that appear in the widely used gitignore collections and in the default files that project tools create for you. They are starting points, not law: read the file once, delete the lines you do not need, and add the ones your project has that the template missed.

How a gitignore generator works

The generator holds one template per stack, each a short list of patterns. Node contributes 9 lines, including node_modules/, npm-debug.log*, .env, dist/, build/, .next/, and coverage/. Python contributes 9 lines, including __pycache__/, *.py[cod], .venv/, and *.egg. The smallest templates are Rust with 4 lines and VS Code with 4 lines.

When you press the button, the generator takes the stacks you ticked, in a fixed order — Node, Python, Java, Flutter, .NET, Go, Rust, macOS, Windows, VS Code, IntelliJ — and joins their templates under heading comments, with a blank line between sections. A header line at the top says the file was generated by Sortrun, so anyone reading the repository knows where it came from.

The results box shows three numbers: the line count, the section count, and the character count. The default selection is 37 lines, 4 sections, and 380 characters. Tick every stack and the file grows to 93 lines, 11 sections, and 792 characters. Tick only Rust and it shrinks to 7 lines, 1 section, and 79 characters.

The patterns themselves use Git's ignore syntax. A trailing slash, like node_modules/, matches a directory. A star, like *.log, matches any file ending in that text. A leading exclamation mark, like !.vscode/settings.json, un-ignores a file that a wider pattern caught — which is how the VS Code section keeps your shared settings while ignoring the rest of the folder.

The templates, and what each one ignores

The language templates ignore build outputs and package folders. Node ignores node_modules/ and the build folders dist/, build/, and .next/, plus log files and the .env file that holds secrets. Python ignores __pycache__/, compiled *.py[cod] files, virtual environments, and packaging folders. Java ignores compiled *.class files, *.jar and *.war archives, and the target/ and build/ folders.

Flutter ignores the build/ folder, the .dart_tool/ folder, and the app bundles *.apk and *.aab, plus the iOS Pods folder. .NET ignores bin/ and obj/, the folders the compiler fills. Go ignores compiled binaries and test outputs. Rust ignores target/, the folder where Cargo puts every build, and the Cargo.lock file that pins dependencies.

The operating-system templates ignore files the OS itself creates. macOS ignores .DS_Store, the file Finder drops in every folder, plus .AppleDouble and .Trashes. Windows ignores Thumbs.db, the thumbnail cache, Desktop.ini, and the recycle bin folder. Neither of those files is part of your project, and both are recreated automatically, so ignoring them costs nothing.

The editor templates ignore settings that belong to one person, not the team. VS Code ignores the .vscode/ folder except for the shared extensions and settings files, which the template un-ignores with ! lines. IntelliJ ignores the whole .idea/ folder and the *.iml project files. Shared editor settings stay in the repository; personal ones stay out.

A worked example: three projects, three files

First, the default: Node, Python, macOS, and VS Code ticked. The file is 37 lines, 4 sections, and 380 characters. It starts with the Node section — node_modules/, the debug logs, .env, dist/, build/, .next/, coverage/ — then Python, then macOS, then VS Code. That is the right starting file for a small web project built on a Mac.

Second, tick everything: all 11 stacks. The file is 93 lines, 11 sections, and 792 characters. It covers a project that genuinely mixes stacks — say, a Flutter app with a Go server and a Python script — but for most projects it is too much. A 93-line gitignore for a single-language project is a sign that nine sections are dead weight, and dead lines are lines nobody reads.

Third, tick only Rust. The file is 7 lines, 1 section, and 79 characters: the header, a blank line, the heading, and 4 patterns — target/, Cargo.lock, **/*.rs.bk, and *.pdb. That is all a small Rust project needs, and it is short enough to read at a glance, which is the whole point of a gitignore.

Notice that some patterns repeat across sections: .env appears in both the Node and Python templates, and dist/ and build/ appear in several. That is honest duplication — each section is a complete standard template on its own, and Git does not mind a pattern appearing twice. If it bothers you, delete the duplicate line; the file still works.

Who generates a gitignore, and why

Developers starting a new project are the main users. The first commit should contain source code, not node_modules, and the fastest way to get that right is to generate the file before the first commit, not after the repository is already full of files it should never have held.

Teams use the generator when they add a new stack to an old project. A Python team that adds a Node front end needs the Node section added to their existing file; generating a fresh file and copying the Node section across takes a minute, and it is more reliable than remembering the patterns from scratch.

Learners use it to see what a .gitignore actually contains. The file is short, the patterns are readable, and each section is labelled, so reading one generated file teaches the whole syntax: slashes for folders, stars for wildcards, and exclamation marks for exceptions.

For the rest of the toolkit, the companions are nearby. A JSON formatter reads the config files that gitignore patterns often protect. A YAML to JSON converter handles the YAML configs that sit beside them. And a regex tester helps when a pattern needs more than a simple star.

Gitignore generator vs writing the file by hand

Writing a .gitignore by hand is fine, and every developer should know the syntax. The generator's value is coverage: it remembers the patterns you forget. Nobody remembers that macOS leaves .AppleDouble files behind, or that Flutter needs .flutter-plugins-dependencies ignored, until the day those files show up in a commit.

The hand-written file has one advantage: it contains only what your project needs. A generated file with all 11 stacks ticked is 93 lines, and most of those lines are noise for a single-stack project. The right habit is to generate, then delete the sections you do not use — the generator gives you the complete list, and you keep the part that fits.

A markdown to HTML converter shows the same trade-off in another form: a tool that produces a complete starting file, which you then edit down. And a CSV to JSON converter is the same idea for data — generate the whole thing, keep the part you need.

The worst option is no .gitignore at all. A repository without one collects node_modules, build folders, and editor files from the first commit, and cleaning them out later means rewriting history. Generating the file before the first commit is a one-minute job that saves an afternoon.

Common gitignore mistakes

The most common mistake is adding the file after the damage is done. A .gitignore only stops new files from being tracked — files already committed stay committed, and Git keeps showing their changes. If node_modules is already in the repository, you must remove it from tracking first; the .gitignore alone will not do it.

Second: committing secrets. A .env file holds API keys and passwords, and it belongs in .gitignore from the first commit. A secret committed once stays in the repository's history even if you delete the file later, and the only safe fix is to rotate the secret. The Node and Python templates both ignore .env for exactly this reason.

Third: ignoring too much. A pattern like * on its own ignores everything, and a pattern like *.json ignores config files your team actually needs. Check the file once after generating it, and un-ignore the files the team shares — the VS Code template shows how, with its ! lines for shared settings.

Fourth: a .gitignore in the wrong place. The file belongs in the root of the repository, next to the README. A .gitignore buried in a subfolder only applies to that folder, which is sometimes what you want, but usually a surprise. Generate one file, put it at the root, and add subfolder files only when a folder genuinely needs its own rules.

How to use this gitignore generator

Using this gitignore generator is simple. Tick the stacks your project uses — Node and Python are ticked by default, along with macOS and VS Code. Tick Java, Flutter, .NET, Go, or Rust if your project uses them, and tick Windows or IntelliJ if your machine or editor needs them. Press Generate .gitignore, and the file appears in the box below, with its line count, section count, and character count shown above it.

To save the file, press Download .gitignore and save it as .gitignore in the root of your repository — the download button sits just below the output box. Or copy the text with the Copy button and paste it into a file yourself. Either way, read it once before the first commit, and delete any section your project does not use.

Everything runs in your browser. No sign-up, no account, no data sent anywhere — the file is built from the templates on this page, and it never leaves your device. It works offline once the page has loaded, so you can generate it on a plane, in a shop with no signal, or anywhere else you start a project.

Try it with something real before you need it: generate the file for your current project, compare it with the .gitignore you already have, and see what it catches that yours missed. Once you have done that, the generator is the first thing you will open for every new repository.

Frequently Asked Questions

Eleven: Node, Python, Java, Flutter, .NET, Go, Rust, macOS, Windows, VS Code, and IntelliJ. Each one adds a section of standard community patterns. The default selection is Node, Python, macOS, and VS Code, which gives a 37-line file with 4 sections and 380 characters.

Yes. The templates are standard community patterns — the same entries that appear in widely used gitignore collections and in the default files that project tools create. They are starting points, not law: read the file once, delete the lines you do not need, and add any patterns your own project needs.

Because both the Node and Python templates ignore it, and each template is complete on its own. Git does not mind a pattern appearing twice. The .env file holds secrets such as API keys, so every stack that uses one ignores it — and a secret committed once stays in the repository history even if the file is later deleted.

A .gitignore only stops new files from being tracked. Files already committed stay committed, and Git keeps showing their changes. To fix it, remove the folder from tracking with git rm -r --cached node_modules and commit that change — after that, the .gitignore keeps it out for good.

More free tools

More calculators and utilities from Sortrun — free, no sign-up.