.gitignore Generator
A .gitignore file lists patterns for files Git should not track. Each line is a glob pattern: "node_modules/" ignores the folder, "*.log" ignores all .log files, "!important.log" un-ignores a specific file. Patterns starting with "/" are anchored to the root. Rules process top to bottom. Place .gitignore in your project root (same folder as .git). Commit it so all team members share the same rules.
Generate a .gitignore file for your project. Select from 17 templates covering Node.js, Python, Go, Rust, Java, Next.js, React, Vue, Django, VS Code, JetBrains, macOS, Windows, Linux, Docker, Terraform, and .env files. Download instantly.
Select Templates
Language / Runtime
Framework
IDE / Editor
OS
Secrets / Config
DevOps
4 templates selected
Preview
# Node.js node_modules/ npm-debug.log* yarn-debug.log* yarn-error.log* .pnpm-debug.log* .npm .yarn-integrity dist/ .env .env.local .env.*.local # VS Code .vscode/* !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json # macOS .DS_Store .AppleDouble .LSOverride ._* .Spotlight-V100 .Trashes # Environment variables .env .env.local .env.*.local *.env
How to Use
- 1
Select your templates
Click the pill buttons to select templates matching your tech stack — Node.js, Python, macOS, VS Code, etc.
- 2
Preview the output
The generated .gitignore content updates instantly as you toggle templates
- 3
Download the file
Click "Download .gitignore" to save the file directly — it will be named .gitignore automatically
- 4
Place in project root
Move the downloaded .gitignore file to your project root directory (same folder as .git)
- 5
Commit to your repo
Run git add .gitignore && git commit -m "Add .gitignore" to track it for all team members
Frequently Asked Questions
- What is a .gitignore file?
- A .gitignore file tells Git which files and directories to ignore — they will not be tracked, staged, or committed. Common ignores include: build output (dist/, build/), dependency folders (node_modules/, .venv/), IDE files (.idea/, .vscode/), OS files (.DS_Store, Thumbs.db), and environment/secret files (.env). Each line is a pattern; lines starting with # are comments.
- How do I create a .gitignore file?
- Select the templates that match your project stack, then click "Download .gitignore". Save the file as ".gitignore" (no extension) in your project root directory (same folder as your .git directory). Git reads this file automatically — no configuration needed. You can also create it manually with a text editor or via terminal: touch .gitignore.
- What should I put in my .gitignore?
- Include: (1) Generated output — dist/, build/, __pycache__/, *.pyc, target/. (2) Dependencies — node_modules/, .venv/, vendor/. (3) Secrets — .env, *.key, credentials.json. (4) IDE/editor files — .idea/, .vscode/ (or only share agreed settings files). (5) OS files — .DS_Store, Thumbs.db. Exclude source code, tests, documentation, and configuration files that others need.
- Should I commit .gitignore to the repository?
- Yes. Commit .gitignore to the repository so all team members and CI/CD systems get the same ignore rules automatically. It is one of the first files to commit in a new project. A personal .gitignore for your IDE/OS preferences can be added to ~/.gitignore_global (configured with: git config --global core.excludesfile ~/.gitignore_global) so it applies to all your repos without polluting the project file.
- Why is node_modules not being ignored even with .gitignore?
- If node_modules/ is already tracked by Git (committed in a previous commit), adding it to .gitignore will not automatically untrack it. Git ignores only untracked files. To fix: run git rm -r --cached node_modules, then commit the change. After that, Git will stop tracking node_modules and the .gitignore rule will take effect. Similarly for any other folder that was accidentally committed.
- How do I ignore all .env files except .env.example?
- Use a negation rule in .gitignore: first ignore all .env files with ".env*", then un-ignore the example file with "!.env.example". The order matters — .gitignore processes rules top to bottom. Example: .env* !.env.example This ignores .env, .env.local, .env.production, etc., but keeps .env.example committed so new developers know which variables to configure.