.gitignore Generator

Build a .gitignore by merging templates for Node, Python, Java, Go, Rust, your OS and your editor, with duplicates removed, then test any path against the rules to see whether Git will track it.

Generator Web & Dev Updated Oct 3, 2026
Learn how this works
How to Use
  1. Pick a group (Languages, OS, Editors) or search, then click every technology your project uses. Click again to remove one.
  2. The merged .gitignore builds as you click. A pattern that two templates share is written once.
  3. Type a path such as build/lib/app.py or .vscode/settings.json into Test a path to see whether Git would ignore it, and which line decides.
  4. Read Show Work for the lines each template added, the duplicates skipped and how the test path was matched.
  5. Press Copy or Download and save the file as .gitignore in the root of your repository.
Templates
relative to the repo root; end a folder with /
Presets
.gitignore
Templates
—
Patterns
—
Duplicates skipped
—
Re-includes (!)
—

Worked Example

A Node app edited in VS Code on a Mac. Node adds 9 patterns, macOS 7 and VS Code 6. None overlap, so the file has 22 patterns. VS Code’s block reads .vscode/* (line 25) then !.vscode/settings.json (line 26). For the path .vscode/settings.json both lines match, and the last match wins: the file is tracked. node_modules/lodash/index.js is ignored before Git even reaches the file — its folder matches node_modules/ on line 5.

Python + Java. 16 + 9 = 25 lines, but both templates list build/. It is written once (line 10, from Python) and Java’s copy is skipped, so the file has 24 patterns. build/lib/app.py is ignored by that line, and so is src/build/x: a pattern without a slash in the middle matches a folder of that name at any depth.

The common mistake: writing .vscode/ and then !.vscode/settings.json. The first line excludes the folder itself, Git never looks inside an excluded folder, and the settings file stays ignored — Git’s documentation says it is not possible to re-include a file if a parent directory of that file is excluded. .vscode/* ignores what is inside the folder instead of the folder, so the ! line can take effect.

Show Work

Pick a template or a preset to see which lines each one adds and why.

Pattern Rules

Name anywhere
*.log
No slash: matches a file or folder of that name at any depth
Folders only
build/
A trailing slash matches folders, never files
Root only
/vendor/
A slash at the start or in the middle ties the pattern to the .gitignore’s folder
Wildcards
*   ?   [abc]   [!a]
* and ? never cross a slash; [Ll]ibrary matches both cases
Any depth
**/name   dir/**   a/**/b
** spans zero or more folders
Exceptions
!keep.txt
Re-includes a path; the last matching line wins, but never inside an excluded folder

Where Ignore Files Came From

Version control systems have always needed a way to leave generated files alone. CVS read a .cvsignore file in each directory, and Subversion kept its ignore list in the svn:ignore property of a folder rather than in a file.

Git, which Linus Torvalds started in April 2005 to manage the Linux kernel source, went back to plain files: a .gitignore in any folder, committed with the project so everyone shares it, plus .git/info/exclude for rules that stay on one machine and a global file named by core.excludesFile. Its patterns use shell-style globbing with a few additions — the trailing slash for folders, ** for any depth and ! for exceptions. GitHub later published a public collection of templates (the github/gitignore repository) and offers them when you create a repository; the templates on this page follow the same conventions.

About This Tool

This generator merges 20 templates — languages and frameworks, operating systems, editors, and logs and secrets — into one .gitignore, in the order you pick them, writing any shared pattern only once.

The path tester applies Git’s own rules: patterns without a slash match at any depth, folder rules match folders only, the last matching line decides, and nothing inside an excluded folder can be re-included. It shows the line that wins, so it doubles as a quick git check-ignore without a terminal. Everything runs in your browser; nothing is uploaded.

It is for developers starting a repository, teams agreeing which editor files to share, and anyone working out why a file never shows up in git status.

Related tools: .htaccess Generator, robots.txt Generator, and JSON to TypeScript.

Frequently Asked Questions

What does a .gitignore file do?

It tells Git which untracked files and folders to leave out of git status and git add, so dependency folders, build output, logs, editor files and secrets never get committed. Each line is a pattern: *.log matches any .log file at any depth, build/ matches a folder named build, /vendor/ only the one at the root, and a leading ! re-includes an exception.

Why combine several templates?

A real project spans several worlds: a Node app edited in VS Code on a Mac needs node_modules/, .vscode/* and .DS_Store all at once. Merging the templates gives full coverage, and patterns they share are written once — Python and Java both list build/, so the two together give 24 patterns, not 25.

Why is .vscode/settings.json still ignored after I added !.vscode/settings.json?

Because the rule above it was .vscode/, which excludes the folder itself. Git never looks inside an excluded folder, so no ! rule can bring a file in it back. Write .vscode/* instead: that ignores the folder’s contents, not the folder, and !.vscode/settings.json then works. Type the path into Test a path to see the difference.

I added a file to .gitignore but Git still tracks it. Why?

.gitignore only affects untracked files. Anything already committed stays tracked until you run git rm --cached <path> (add -r for a folder) and commit. If the file was a secret such as a .env with API keys, rotate the keys too: the old commit still contains them.

Where else can ignore rules live?

A .gitignore can sit in any folder and applies to that folder and below; the one in the root is the usual place. Rules just for you go in .git/info/exclude, which is never committed, and rules for every repository on your machine (such as .DS_Store) go in a global file set with git config --global core.excludesFile. git check-ignore -v <path> prints the file and line that ignores a path.

How do I use the .gitignore Generator?

Just pick your options. The answer shows up right away — there is no button to press. Change anything and it updates by itself.

Do I need to install or sign up for anything?

Not at all — it runs in the browser with nothing to install and no account. After it loads once, it even works without an internet connection.

Is my information private?

Yes. Everything happens in your browser. Nothing you type is sent to a server or saved anywhere.

Common Use Cases

Start a new repository

Generate the file before the first commit, so node_modules/, with its thousands of files, or a .env file never enters the history.

Cover the whole stack

A Laravel app with Composer gets 12 patterns from two templates: /vendor/ and .env appear in both and are written once.

Share editor settings

Ignore personal VS Code files but keep settings.json, tasks.json, launch.json and extensions.json for the team.

Debug a missing file

Paste the path of a file that will not show in git status and see the exact line that ignores it.

Check an .env.example

With the PHP / Composer template, .env.* also hides .env.example; test it before you wonder why the sample config never reached the repo.

Last updated: