.gitignore Generator
Select any combination of languages, frameworks, editors, and tools to generate a complete .gitignore file instantly.
Select Stacks
Languages
Frontend
Backend
Mobile
Databases
DevOps
Editors
Build Tools
OS & Package Managers
# Generated by DevKit .gitignore Generator # https://devkit.escalixstudio.com/gitignore-generator # === Node.js === # Node.js node_modules/ npm-debug.log* yarn-debug.log* yarn-error.log* pnpm-debug.log* lerna-debug.log* .npm .yarn-integrity .pnp.* .yarn/cache .yarn/unplugged .yarn/build-state.yml .yarn/install-state.gz # Build output dist/ build/ out/ # Environment files .env .env.local .env.*.local .env.development.local .env.test.local .env.production.local # Runtime data *.pid *.seed *.pid.lock # Coverage coverage/ .nyc_output/ lib-cov/ # Cache .cache/ .parcel-cache/ .eslintcache .stylelintcache .node_repl_history # === VS Code === # VS Code .vscode/* !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json !.vscode/*.code-snippets .history/ *.vsix # === macOS === # macOS .DS_Store .AppleDouble .LSOverride Icon # Thumbnails ._* # Files that might appear in the root of a volume .DocumentRevisions-V100 .fseventsd .Spotlight-V100 .TemporaryItems .Trashes .VolumeIcon.icns .com.apple.timemachine.donotpresent # Directories potentially created on remote AFP share .AppleDB .AppleDesktop Network Trash Folder Temporary Items .apdisk
What Does .gitignore Do?
Every project generates files that should never end up in version control: compiled binaries, dependency directories, editor config, operating system metadata, and — most critically — environment files containing secrets. The .gitignore file is a plain-text list of patterns that tells Git to silently skip matching paths during git add, git status, and git commit. Patterns can match filenames, extensions (*.log), directories (dist/), or specific paths. Lines starting with # are comments. Prefixing a pattern with ! negates it, creating exceptions to broader ignore rules.
What to Always Gitignore
Regardless of your stack, certain categories of files should always be excluded from version control:
Environment & Secrets
.env, .env.local, *.pem, *.key — credentials must never be committed.
Dependencies
node_modules/, vendor/, .venv/ — these are reproducible from lock files.
Build Output
dist/, build/, out/, target/ — generated code should be rebuilt, not tracked.
OS & Editor Files
.DS_Store, Thumbs.db, .idea/, .vscode/ — personal environment noise.
Log Files
*.log, npm-debug.log*, crash.log — transient runtime data.
Cache Directories
.cache/, .parcel-cache/, .eslintcache — regenerated automatically.
Global vs Project .gitignore
There are two levels of gitignore: project-level (.gitignore at the repo root, committed alongside your code) and global (a personal file that applies to every repo on your machine). Set up your global gitignore with:
git config --global core.excludesfile ~/.gitignore_global
Put OS-specific patterns (.DS_Store, Thumbs.db) and editor files (.idea/, .vscode/) in your global file so you never have to add them to individual project repos. This keeps project .gitignore files focused on build artifacts and framework-specific patterns, making them more useful to collaborators on different systems and editors.
Frequently Asked Questions
What is a .gitignore file?
A .gitignore file tells Git which files and directories to ignore when tracking changes in a repository. Any file or folder matching a pattern in .gitignore will not be staged, committed, or pushed to the remote — keeping your repo clean of build artifacts, environment secrets, and OS-generated clutter.
Why should I ignore node_modules in .gitignore?
The node_modules directory can contain thousands of files and hundreds of megabytes of dependencies. Since these are fully reproducible by running 'npm install' (or yarn/pnpm), committing them wastes space, slows down clone times, and pollutes diffs. Always add node_modules/ to your .gitignore and rely on package.json + lock files instead.
Should I put .env files in .gitignore?
Yes — always. .env files typically contain database URLs, API keys, private tokens, and other credentials that must never be committed to version control. Once a secret is pushed to a public repo, it should be considered compromised even if you delete it later, because Git history retains it. Use .env.example with placeholder values to document required variables.
What is a global .gitignore and when should I use it?
A global .gitignore (configured via 'git config --global core.excludesfile ~/.gitignore_global') applies to every repository on your machine. It is ideal for OS-specific files like .DS_Store (macOS) or Thumbs.db (Windows) and editor files like .vscode/ or .idea/ — things that are personal to your environment rather than project-specific. This keeps your project .gitignore clean and shareable.
My .gitignore isn't working — what's wrong?
The most common reason is that the file was already tracked by Git before you added it to .gitignore. Git only ignores untracked files, so if a file was previously committed, adding it to .gitignore has no effect. To fix this, run: git rm --cached <file> (or git rm -r --cached . for all files), then re-commit. This removes the file from Git's index without deleting it from disk.