What this tool does
The generator bundles 99 templates from github.com/github/gitignore, taken from the repository on 30 October 2026: languages and runtimes, frameworks and game engines, build and infrastructure tools, editors and IDEs, and operating systems. Templates are copied as published, comments included, and appear in the order you pick them. With Remove duplicates on, a pattern line that already appears higher up is dropped, but only when that cannot change the result: if a ! rule that could match the same paths sits between the two copies, the later copy is kept, because Git uses the last line that matches. Custom lines are added at the end exactly as you type them. The path tester applies Git's rules to the whole file: # comments and blank lines, trailing spaces, ! to re-include, a leading or middle / to anchor a pattern to the root, a trailing / for folders only, *, ?, [a-z] and ** wildcards, and the rule that nothing inside an ignored folder can be re-included. It was checked against git check-ignore on more than 100,000 path and pattern combinations. It models one .gitignore at the repository root: nested .gitignore files, .git/info/exclude and your global excludes file are not included, and it cannot know which files Git already tracks.
Example input and output
Templates: Rust, VS Code### Rust ###
# Generated by Cargo
# will have compiled files and executables
debug
target
# These are backup files generated by rustfmt
**/*.rs.bk
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
# Generated by cargo mutants
# Contains mutation testing data
**/mutants.out*/
# rustc will dump stack traces when hitting an internal compiler error to PWD
rustc-ice-*.txt
# RustRover
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
### VS Code ###
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
!*.code-workspace
# Built Visual Studio Code Extensions
*.vsixdebug and target have no slash, so they match a file or folder with that name at any depth. The VS Code lines ignore the .vscode folder's contents but re-include the shared settings, tasks and launch files.
node_modules/react/index.js
.env
.env.example
.vscode/settings.json
.vscode/bookmarks.json
src/index.jsIgnored node_modules/react/index.js
Inside node_modules/, which is ignored by line 42 node_modules/ (Node).
Ignored .env
Matched by line 70 .env (Node).
Not ignored .env.example
Re-included by line 72 !.env.example (Node).
Not ignored .vscode/settings.json
Re-included by line 214 !.vscode/settings.json (VS Code).
Ignored .vscode/bookmarks.json
Matched by line 213 .vscode/* (VS Code).
Not ignored src/index.js
No line matches, so Git can track it.Line numbers refer to the generated file, and the name in brackets is the template the line came from. git check-ignore -v reports the same lines.
Custom lines:
build/
!build/keep.txt
Path: build/keep.txtIgnored build/keep.txt
Inside build/, which is ignored by line 2 build/ (Custom). Git never looks inside an ignored folder, so line 3 !build/keep.txt (Custom) has no effect. To allow exceptions, ignore the folder's contents instead (build/*).With build/* instead of build/, the same path shows Not ignored, re-included by line 3, while build/app.js stays ignored by line 2.
Common errors and fixes
- A file is still committed after adding it to .gitignore
- .gitignore only affects files Git does not track yet. Stop tracking the file but keep your copy with git rm --cached path (git rm -r --cached folder/ for a folder), then commit. Earlier commits still contain it, so rotate any credential that was ever committed.
- !build/keep.txt has no effect
- Git does not look inside an ignored folder, so nothing in it can be re-included. Replace build/ with build/* so the folder's contents are ignored rather than the folder itself, and keep the ! line below it. The path tester names the ! line that is blocked.
- /build and build/ ignore different things
- A leading / anchors a pattern to the folder that holds the .gitignore, so /build matches only the top-level build, file or folder. A trailing / matches folders only, at any depth: build/ matches src/build/ but not a file called build. Plain build matches both, anywhere.
- docs/*.md does not match a/docs/guide.md
- Any slash except a trailing one anchors the pattern to the .gitignore's folder, and * never crosses a /. Write **/docs/*.md to match at any depth, or docs/**/*.md to include subfolders of docs.
- A template ignores more than expected, such as src/lib
- Template lines without a slash match at any depth: the Python template's lib/ also ignores src/lib/, and Rust's debug ignores any file or folder named debug. Add an exception after the template, such as !src/lib/, or anchor the line as /lib/. Test the path here to see which line decides.
- A pattern with a trailing tab or a pasted invisible character matches nothing
- Git trims trailing spaces from a pattern but keeps tabs and characters such as a non-breaking space, so the pattern looks for a name that ends in them. Delete them. To match a name that really ends in a space, escape it: foo\ .
- .gitignore made with echo in Windows PowerShell is ignored
- In Windows PowerShell 5, echo node_modules > .gitignore writes UTF-16 text, which Git cannot read. Save the file as UTF-8 instead, for example with Set-Content .gitignore node_modules -Encoding utf8, or download it from this page.
Common use cases
- Starting the .gitignore for a new repository in any language
- Combining language, framework, editor and OS rules for a monorepo
- Finding out which line makes git add skip a file
- Checking that a ! exception really re-includes the file you need
- Adding editor and operating-system rules to an existing project
Privacy and security notes
- The templates are bundled with the page and the file is built by JavaScript in this browser tab. The templates you pick, your custom lines and the paths you test are not sent to DevPrix or GitHub.
- The path tester only looks at the paths you type. It does not read your disk or your repository, and nothing you type is stored.
Frequently asked questions
How do I set up a global .gitignore for all my repositories?
Put rules for your own machine, such as macOS's .DS_Store or your editor's folders, in one file and point Git at it: git config --global core.excludesFile ~/.gitignore_global. If you never set it, Git reads $XDG_CONFIG_HOME/git/ignore, which is ~/.config/git/ignore by default. Those rules apply to every repository on your computer but not to your teammates, so rules the project needs belong in the repository's own .gitignore.
How do I ignore a file only in my copy of a repository?
Add it to .git/info/exclude. It uses the same syntax as .gitignore but lives inside the .git folder, so it is never committed or shared. It only works for untracked files; for a tracked file you want Git to stop showing as changed, such as a local config, git update-index --skip-worktree path tells Git to leave your copy alone, and --no-skip-worktree undoes it.
How can I check why a file is ignored?
Run git check-ignore -v path. It prints the file, line number and pattern that decides, for example .gitignore:42:node_modules/ followed by the path, including a ! line that re-includes it. Add --no-index to check a file that is already tracked, and use git status --ignored to list ignored files. The tester on this page applies the same rules to the generated file.
Can I use these templates in my project?
Yes. They come from github.com/github/gitignore, which GitHub publishes under CC0-1.0, a public-domain dedication, so you can copy, change and commit them without attribution. This page bundles 99 of them as of commit 47c9b1c from 30 October 2026; the upstream repository may have changed since.
Why wasn't the download saved as .gitignore?
Files whose names start with a dot are hidden on macOS and Linux, and some browsers rename them when saving, for example to gitignore or gitignore.txt. Show hidden files, or rename the download to .gitignore in your project's root folder. You can also Copy the text and paste it into a new file.