Skip to content
My Tiny Utils

Search tools

Type to find a tool, then press Enter to open it.

Gitignore Generator

Build a .gitignore from 34 templates for languages, frameworks, editors, and operating systems, merged without duplicates — then test whether a path is ignored and by which rule.

Processed locally in your browser — nothing is uploaded.

Gitignore Generator

Languages

Frameworks & tools

Editors & IDEs

Operating systems

0 characters

.gitignore

Output appears here…

0 characters

End a path with / to test it as a folder. A .gitignore only affects untracked files — anything already committed stays tracked until you run git rm --cached on it.

About Gitignore Generator

Pick the languages, frameworks, editors, and operating systems your project involves — Node, Python, Java, Go, Rust, .NET, Swift, Unity, Next.js, Terraform, VS Code, JetBrains, macOS, Windows, and more — and get one .gitignore with a header per section. Patterns that appear in more than one template, like dist/ or .env, are written once, and sections always come out in the same order so a rule that re-includes a file (Gradle's !gradle/wrapper/gradle-wrapper.jar) lands after the rule it overrides (Java's *.jar). Add your own patterns under Custom rules, then copy or download the file.

Each template is a short, conventional set of patterns: the build output, dependency folders, caches, logs, and local settings that kind of project produces, without the long tail of rarely needed entries. Read through the result before committing it — a template can ignore something your project deliberately tracks.

Test a path before you commit. List paths under Paths to test and each one is marked Ignored or Tracked with the line that decided it, the way git check-ignore -v reports it. Matching follows Git's rules:

  • The last matching pattern wins, and a pattern starting with ! re-includes what an earlier one ignored.
  • A trailing slash matches folders only: build/ ignores a build folder but not a file named build. End a test path with / to test it as a folder.
  • A slash at the start or in the middle anchors the pattern to the repository root: /todo.txt matches only the top-level file, while todo.txt matches one at any depth.
  • ** spans folders: **/logs matches logs anywhere, logs/** everything inside it, and a/**/b matches a/b, a/x/b, and a/x/y/b. A single * or ? never crosses a slash.
  • Nothing inside an ignored folder can be re-included. Git doesn't look inside a folder it ignores, so logs/ followed by !logs/keep.log still ignores keep.log. Ignore the contents instead — logs/* then !logs/keep.log — and the tester explains which case you're in.

Comments, blank lines, escaped characters like \# and \!, escaped trailing spaces, and character classes like *.py[cod] and [Dd]ebug/ are handled too. The Options drawer switches on case-insensitive matching, which is how Git behaves in repositories cloned on macOS and Windows.

Common uses

  • Start a new repository with a .gitignore that covers the language, framework, and editor you use
  • Add the OS and IDE junk files (.DS_Store, Thumbs.db, .idea/) a teammate keeps committing
  • Work out why a file isn't showing up in git status, or why a ! rule isn't re-including it
  • Check a .gitignore change before committing it, by pasting the file into Custom rules

Example

Input

Templates: Node, Environment files
Custom rules: logs/
!logs/keep.log

Test: .env.example, logs/keep.log

Output

.env.example — Tracked: re-included by !.env.example
logs/keep.log — Ignored: inside logs/, which logs/ ignores. Git doesn't look inside ignored folders, so !logs/keep.log can't re-include it.

Node's template already ignores logs/, so the custom logs/ line is dropped as a duplicate; writing logs/* instead would let the ! rule work.

Limitations

  • A .gitignore only affects untracked files: anything already committed stays tracked until you remove it from the index with git rm --cached
  • The tester reads one .gitignore at the repository root; Git also applies .gitignore files in subfolders, .git/info/exclude, and your global core.excludesFile
  • Whether a test path is a file or a folder comes from the trailing slash you type, since the tool can't see your disk
  • .dockerignore and other ignore files use similar but different rules — Docker, for example, anchors every pattern to the build context root

Frequently asked questions

How do I create a .gitignore file?

Select the templates for your project's language, framework, editor, and operating system, add any custom patterns, and press Download — the file is saved as .gitignore. Put it in the root of your repository and commit it. If your system hides or renames files that start with a dot, copy the text into a new file named .gitignore instead.

Why is a file still tracked after I added it to .gitignore?

Because .gitignore only stops untracked files from being added; files Git already tracks are unaffected. Remove the file from the index while keeping it on disk with git rm --cached path/to/file (or git rm -r --cached folder/), then commit. From then on the ignore rule applies.

Why doesn't my ! negation rule work?

Usually because a parent folder is ignored. Git doesn't look inside an ignored folder, so a rule like !logs/keep.log after logs/ can't bring the file back. Ignore the folder's contents instead — logs/* followed by !logs/keep.log — and the negation works. Test the path here to see which rule decides it.

What's the difference between folder/, /folder, and folder/** in .gitignore?

folder/ matches a folder named folder at any depth, but not a file with that name. /folder matches a file or folder named folder only at the repository root. folder/** matches everything inside folder but not folder itself, which is what lets later ! rules re-include individual files in it.

Should .env files be in .gitignore?

Yes — .env files usually hold passwords and API keys, and anything committed stays in the repository's history even after you delete it. The Environment files template ignores .env and .env.* while keeping .env.example, .env.sample, and .env.template, so you can commit a template of the variables without their values.

Is anything I enter sent to a server?

No. The .gitignore is assembled and the path tests run in your browser, so your file names and folder structure stay on your machine.