.gitignore Builder
Select the languages and frameworks used in your project. The builder combines the relevant templates into a single, deduplicated .gitignore file ready to copy.
100% client-side · no upload
Select templates
How to use the .gitignore Builder
- Check the boxes for each language and framework in your project.
- The output updates automatically and deduplicates overlapping rules.
- Click Copy and save the result as
.gitignorein your project root. - Run
git statusto verify unwanted files are now ignored.
Common use cases
- New project setup: Generate a comprehensive .gitignore before the first commit.
- Monorepo: Select multiple stacks and combine their templates into one file.
- Missing rules: Find rules you forgot by browsing templates for your stack.
Related tools: .env Formatter · Dockerfile Linter · GitHub Actions Linter · All DevOps Tools
Frequently Asked Questions
- What is a .gitignore file?
- A .gitignore file tells Git which files and directories to ignore in version control. Ignored files are not staged, committed, or pushed. Common ignores include compiled binaries, dependency directories (node_modules, vendor), build artifacts, IDE config, and files containing secrets.
- Where should I put the .gitignore file?
- The root .gitignore applies to the entire repository. You can also add .gitignore files in subdirectories to apply rules only within that directory. For machine-specific ignores (e.g. your IDE settings), use ~/.gitignore_global to keep them out of shared project files.
- How do I ignore a file that is already tracked by Git?
- Adding a file to .gitignore does not untrack it if it was already committed. Run: git rm --cached filename to untrack it without deleting the local file, then commit the change.
- Can I ignore all files in a directory but not the directory itself?
- Add a .gitkeep file to the directory and add /* to .gitignore for that directory path. Alternatively, ignore all contents with path/to/dir/* while keeping path/to/dir/.gitkeep tracked.
- Why should I not commit node_modules?
- node_modules can contain thousands of files and hundreds of megabytes. Dependencies are reproducible from package.json via npm install or yarn install. Committing them bloats the repository, slows clones, and introduces platform-specific binaries that break cross-OS workflows.
- Should I commit lock files (package-lock.json, yarn.lock)?
- Yes. Lock files pin exact dependency versions, making installs reproducible across machines and CI environments. Commit them for applications; for libraries, it is debatable whether to commit or ignore the lock file.
- How do I ignore files matching a pattern in any subdirectory?
- Use a pattern without a leading slash: *.log matches log files anywhere in the tree. A leading slash anchors to the root: /debug.log only matches at the repository root.
- What is the .gitignore_global file?
- A global gitignore file that applies to all repositories on your machine. Configure it with: git config --global core.excludesfile ~/.gitignore_global. Use it for editor-specific files (.DS_Store, .idea, *.swp) so you do not pollute project .gitignore files.