Generators tool

.gitignore Generator: Templates for Node, Python and More

Generate a .gitignore file for Node, Python, .NET, Unity or any mix of 70 languages, frameworks, editors and OSes. Copy or download it. Nothing is uploaded.

Last updated

A .gitignore file tells Git which files to leave out of your repository: dependencies, build output, logs, secrets and the clutter your editor and operating system leave behind. Tap a preset or search for your languages, frameworks, editors and OS, and the combined .gitignore builds as you pick.

Start from a preset

Your .gitignore
Tap a preset or pick templates above, and the combined file appears here.

Built in your browser from 70 templates copied from github/gitignore (CC0, public domain) on 2026-09-28. Nothing you pick is uploaded.

Templates are joined in the order you pick them, each under its own ### Name ### header. A rule that is already in the file is not written again, so picking Visual Studio and .NET together does not list [Bb]in/ twice.

How to use it

  1. Tap Node, Python, .NET or Unity to start from a preset, or skip straight to the search.
  2. Search for anything else your project uses, such as jetbrains, rust or terraform, and tap it to add it. The filter row narrows the list to languages, frameworks, editors or operating systems.
  3. Tap a picked template again, or its chip above the output, to take it out.
  4. Tap Copy and paste into a file called .gitignore in the root of your repository, or tap Download to save the file.
  5. Commit it: git add .gitignore then git commit.

Some browsers save a download whose name starts with a dot as gitignore or gitignore.txt. If yours does, rename it to .gitignore.

What each preset includes

PresetTemplates
NodeNode, VS Code, macOS, Windows
PythonPython, VS Code, macOS, Windows
.NET.NET, Visual Studio, VS Code, macOS, Windows
UnityUnity, VS Code, macOS, Windows

macOS and Windows are in every preset because a shared repository usually has people on both, and .DS_Store or Thumbs.db turn up in commits otherwise. Swap VS Code for JetBrains if you use IntelliJ, PyCharm, WebStorm or Rider.

.gitignore pattern syntax

Each line of a .gitignore is one pattern. Blank lines are ignored, and a line starting with # is a comment.

PatternMatches
debug.logA file or folder named debug.log anywhere in the repository
*.logAnything ending in .log. * matches anything except /
build/A folder named build anywhere, and everything in it, but not a file called build
/buildbuild only in the folder the .gitignore is in
docs/*.md.md files directly in docs, not in its subfolders
docs/**/*.md.md files anywhere under docs. ** matches any number of folders
!keep.logRe-includes keep.log after an earlier rule ignored it
\#notesA file literally named #notes. The backslash stops it being a comment

When two lines match the same file, the last one wins. That is why a ! line has to come after the rule it overrides, and why this generator never drops a repeated rule that comes after a ! line.

.gitignore gotchas

  • Already-tracked files stay tracked. Adding config.json to .gitignore does nothing if it was committed before. Run git rm --cached config.json (add -r for a folder) and commit, and the file stays on disk but leaves the repository. Anything secret in it is still in the history, so rotate it.
  • You cannot re-include a file inside an ignored folder. With logs/ in the file, !logs/keep.log has no effect, because Git never looks inside logs. Ignore the contents instead, logs/*, then re-include with !logs/keep.log.
  • Find out which rule ignores a file. git check-ignore -v path/to/file prints the .gitignore, the line number and the pattern that matched.
  • Personal files belong elsewhere. Your editor's settings are not the team's business. Put rules like those in a global ignore file, set with git config --global core.excludesFile ~/.gitignore_global, or in .git/info/exclude, which applies to one clone and is never committed.
  • Ignoring a lockfile is usually wrong. package-lock.json, pnpm-lock.yaml, poetry.lock and Cargo.lock pin the exact versions your app was tested with, so commit them. Two templates here disagree: Angular ignores /package-lock.json and /yarn.lock, and Firebase ignores /functions/package-lock.json. Delete those lines if you pick either.
  • Empty folders are not tracked. Git stores files, not folders. A common trick is to put an empty .gitkeep file in a folder you want to keep.

Where the templates come from

The templates are copied from github/gitignore, the collection GitHub offers when you create a new repository, at a fixed commit named under the tool. It is released under CC0 1.0, a public domain dedication. The list here is a curated set of the 70 most useful: the common languages, frameworks and build tools, editors and IDEs, and operating systems. They ship with the site, so the tool never calls GitHub or any other service.

Common questions

What is a .gitignore generator?

A .gitignore generator builds the .gitignore file for a project from ready-made templates. You pick your language, framework, editor and operating system, and it joins their templates into one file that tells Git which files to leave out of version control: installed packages, build output, logs, editor settings and system clutter. This one uses the templates from GitHub's own github/gitignore collection and runs in your browser.

What should a Node .gitignore include?

At minimum node_modules/, since installed packages are rebuilt from package.json and the lockfile, plus log files, coverage reports, build output such as dist, and .env files that hold secrets. The Node template here covers all of those, with caches for tools like Next.js, Nuxt and Parcel. Tap the Node preset to get it with VS Code, macOS and Windows added.

What should a Python .gitignore include?

__pycache__/ and compiled .pyc files, virtual environments such as .venv/ and venv/, build and packaging folders like build/, dist/ and *.egg-info/, test and coverage caches, and .env files. The Python template here includes all of these and notes for Poetry, Pipenv, PDM and uv lockfiles. Tap the Python preset to start from it.

Why is Git still tracking a file I added to .gitignore?

A .gitignore only affects files Git is not already tracking. If a file was committed before you added the rule, remove it from the index with git rm --cached followed by the file name (add -r for a folder), then commit. The file stays on your disk, and from then on Git ignores it.

Where do I put the .gitignore file?

In the root folder of the repository, next to the .git folder, and commit it so everyone on the project shares it. Rules apply to that folder and everything below it. You can add more .gitignore files in subfolders, and their rules apply relative to where they sit.

Should I commit the .gitignore file?

Yes. Committing it means every clone ignores the same files, so nobody commits node_modules or a .env file by accident. For files only you create, such as your own editor's settings, use a global ignore file set with git config --global core.excludesFile, or the repository's .git/info/exclude, which is never committed.

Where do these .gitignore templates come from?

They are copied from github/gitignore, the collection GitHub itself offers when you create a repository, at a fixed commit named under the tool. The collection is released under CC0, a public domain dedication, so the templates are free to use and change. They ship with this site rather than being downloaded from GitHub as you use the tool, and nothing you pick is uploaded.

See all tools

Want this explained by a cat?

The videos cover the same ground in sixty seconds. If there is a tool you want built next, ask.