Skip to main content
Toolisti

.gitignore Generator

The .gitignore Generator builds a git ignore file from more than 45 templates covering languages, frameworks, build tools, editors and operating systems.

100% in-browser Β· no data sent

It collapses patterns that appear in several templates, so combining Java and Maven does not ignore <code>target/</code> twice, and it can merge into a .gitignore you already have β€” adding only what is genuinely new and leaving your existing rules, including your <code>!</code> negations, exactly as you wrote them.

Embed This Tool

Add this tool to your website with customizable styling

Get Embed Code

How to Use

1

Pick your templates

Select every language, framework, editor and operating system your team actually uses. Search by name if the list is long. Committing your colleague's editor files is the most common reason a repository fills with noise.

2

Add your own rules

Anything specific to your project goes in the custom rules box β€” one pattern per line. Comment lines starting with # are kept as you wrote them.

3

Merge into an existing file, if you have one

Tick "merge into an existing .gitignore" and paste your current file. The result keeps it verbatim at the top and appends only the rules it does not already cover.

4

Copy or download

Copy the output, or download it straight as a .gitignore. Save it at the root of your repository, where it applies to every directory below it.

Frequently Asked Questions

Why did some patterns disappear when I picked two templates?

They did not disappear, they were collapsed. Java and Maven both ignore target/; Gradle and Kotlin both ignore .gradle/. Writing the same pattern twice changes nothing about how git behaves, but it makes the file harder to read and harder to review. Turn off "remove duplicate patterns" if you want each template's block kept whole.

Will merging overwrite the .gitignore I already have?

No. Your file is reproduced exactly, and new rules are appended below it under a marker comment. A pattern you already have is never repeated, and a pattern you deliberately un-ignored with a ! rule is never re-added β€” re-adding .env underneath your !.env would quietly reverse a decision you made on purpose.

Does adding a rule to .gitignore untrack a file I already committed?

No, and this catches people out constantly. .gitignore only affects untracked files. Once a file is committed git keeps tracking it regardless. Run git rm --cached path/to/file to stop tracking it while keeping it on disk, then commit that removal. For a whole directory add -r.

Where should the .gitignore file live?

The root of the repository, which is what this tool's output assumes. Rules apply to that directory and everything under it. You can also place additional .gitignore files in subdirectories for rules that only make sense there, and put personal rules that should not be shared with your team in .git/info/exclude instead, which is never committed.