.gitignore Generator

Select your languages, frameworks and tools, then click Generate to get a ready-to-use .gitignore file.

By Pankaj Kumar · DevToolsHub · Last updated May 2026

What is a .gitignore file?

A .gitignore file is a plain text file at the root of a Git repository that tells Git which files and directories to ignore — never track, never stage, never commit. Every project has files that should not be in version control: dependency directories like node_modules, compiled output like bin/ and dist/, IDE configuration folders like .vscode/ and .idea/, operating system files like .DS_Store and Thumbs.db, and most critically, secrets and credentials that must never be committed.

How .gitignore pattern matching works

Each line in a .gitignore file is a pattern. Git applies these rules:

  • Exact name: node_modules ignores any file or directory with that name anywhere in the tree
  • Trailing slash: node_modules/ ignores only directories, not files with that name
  • Glob patterns: *.log ignores all files ending in .log; *.py[cod] ignores .pyc, .pyo, .pyd
  • Double asterisk: **/logs ignores any directory named logs at any depth; logs/** ignores everything inside the logs directory
  • Negation: A leading ! un-ignores a pattern previously ignored — for example !important.log after *.log
  • Comments: Lines starting with # are comments

The most important things to ignore

  • Secrets: .env, .env.local, secrets.json, certificate files (*.pem, *.key), credential files. A leaked API key or database password committed to a public repo is a critical security incident.
  • Dependencies: node_modules/ (npm/yarn), vendor/ (PHP/Go), .gradle/, packages/ — these are reproduced from lock files and should never be committed
  • Build output: dist/, build/, bin/, obj/, out/ — generated from source and easily reproducible
  • IDE configuration: .idea/, .vscode/ (optionally — some teams commit VS Code settings), *.suo, *.user
  • OS files: .DS_Store (macOS), Thumbs.db, desktop.ini (Windows)

How to use this tool

  1. Select all the languages, frameworks, and tools your project uses.
  2. Click Generate .gitignore.
  3. Copy the output and save it as .gitignore at your repository root.
  4. Commit the .gitignore file itself — it should always be tracked by Git.

A worked example: the VS Code template

Most templates here are a flat list of patterns, but the VS Code template is more deliberate: it ignores everything in .vscode/ with .vscode/*, then un-ignores five specific items with ! negation — settings.json, tasks.json, launch.json, extensions.json, and any .code-snippets file. That's a common real-world pattern: share the editor config that makes a project consistent for every contributor (recommended extensions, debug configs, snippets) while keeping personal workspace state out of version control.

Already tracked files

Adding a path to .gitignore does not stop Git from tracking files it has already committed. If you accidentally committed node_modules or a .env file, you must remove them from tracking explicitly: git rm --cached node_modules -r removes a directory from the index while keeping it on disk. After running this and committing the removal, the .gitignore entry will prevent future tracking. For sensitive files already in history, consider rotating the credentials and using git filter-repo to purge the file from all commits.

This tool is built with ASP.NET Core 8, Blazor Server, and the .NET standard library. It runs securely on Microsoft Azure.
Input Section
Languages
Frameworks
OS & Tools
Output Section

Generated .gitignore

.gitignore