Gitignore Generator
Generate a .gitignore file for any language, framework or IDE combination. Select presets and copy or download the result. Free, runs in your browser.
Why Use a .gitignore File?
A .gitignore file tells Git which files and directories to exclude from version control. Without it, you risk accidentally committing build artifacts, log files, IDE configuration, environment secrets (.env), or compiled binaries. These bloat your repository and may expose sensitive data.
Common .gitignore Patterns
| Pattern | What it ignores |
|---|---|
*.log | All log files |
node_modules/ | NPM dependencies directory |
.env | Environment variable file |
dist/ | Build output directory |
**/__pycache__/ | Python bytecode cache |
.DS_Store | macOS finder metadata |
Tips for Using .gitignore Effectively
Commit your .gitignore as early as possible — ideally as the first or second commit, before any files you want to ignore are tracked. If a file is already tracked by Git, adding it to .gitignore does not un-track it. You must explicitly remove it from tracking: git rm --cached <file> removes it from Git's index without deleting it from disk, and subsequent commits will no longer include it.
Global .gitignore — Ignoring Files Across All Repositories
For files that your editor or OS always generates (like .DS_Store on macOS, Thumbs.db on Windows, or .idea/ from JetBrains IDEs), use a global .gitignore so you do not have to repeat them in every project:
- Create the file:
touch ~/.gitignore_global - Register it with Git:
git config --global core.excludesFile ~/.gitignore_global - Add OS and editor patterns to it. These are applied to every repository on your machine without polluting the project's own .gitignore.