Gitignore Generator
Free gitignore generator: pick your languages, frameworks, editors and operating systems, and get one clean .gitignore file with section headers and no duplicate rules.
No template matches your search.
0 rules · 0 duplicates removed
Create a .gitignore File for Your Project
A .gitignore file tells Git which files to leave out of your repository: dependencies, build output, logs, local settings and secrets such as .env files. This gitignore generator combines ready-made templates for your languages, frameworks, editors and operating systems into one file.
The templates are based on the official github/gitignore collection, trimmed of explanatory comments. Rules that appear in several templates are written only once, each block gets a clear header, and you can add your own rules at the end before you copy or download the file.
How to generate a .gitignore file
- Search or browse the templates and click each one that matches your project: language, framework, editor and operating system.
- Review the output. Keep section headers on so you can see where each rule comes from, and leave duplicate removal switched on.
- Add your own rules, such as a local uploads folder or a private config file.
- Download the file or copy it, and save it as
.gitignorein the root folder of your repository. - Commit it with
git add .gitignorebefore adding the rest of the project.
Gitignore pattern syntax
| Pattern | Meaning | Example match |
|---|---|---|
*.log | * matches anything except a slash | debug.log, logs/app.log |
build/ | A trailing slash matches folders only | build/, app/build/ |
/vendor/ | A leading slash anchors to the folder of the .gitignore | vendor/ in the root only |
**/temp | ** matches any number of folders | temp, a/b/temp |
!.env.example | ! re-includes a file excluded earlier | Keeps .env.example tracked |
*.py[cod] | Brackets match one character from the set | a.pyc, a.pyo |
# note | Lines starting with # are comments | Nothing |
How the merge works
Templates are added in a fixed order, languages and frameworks first and editors and operating systems last, so the file reads the same way every time. Each rule is compared with the rules already written; when it is an exact duplicate, it is skipped and counted. Negation rules that start with ! are always kept, because their position decides what they re-include.
The data comes from the github/gitignore repository, which is published under the CC0 public domain dedication. A few entries are curated: Django combines the Django and virtual environment rules of the Python template, Flutter / Dart keeps the app-relevant lines of the Flutter template, and Docker lists common local Compose overrides and environment files.
Tips and common problems
- Already tracked files are not ignored. If a file was committed before it was added to .gitignore, untrack it with
git rm --cached path/to/fileand commit. - Never commit secrets. Keep
.envignored and commit a.env.examplewith dummy values instead. If a secret was pushed, rotate it: removing the file does not erase Git history. - Debug a rule with
git check-ignore -v path/to/file, which prints the pattern and line that ignore the file. - A folder excluded by a pattern cannot have files re-included with
!. Exclude its contents (folder/*) instead of the folder itself. - Put personal editor and OS rules in a global file with
git config --global core.excludesFile ~/.gitignore_global, or in.git/info/excludefor one repository only. - Deploying with Apache? Create the server config with the htaccess generator.
Frequently Asked Questions
Common questions about .gitignore files.
It is a plain text file in your repository that lists patterns for files and folders Git should not track, such as node_modules, build output, logs and local environment files.
Put it in the root folder of the repository. You can add more .gitignore files in subfolders; their patterns apply relative to the folder they are in.
Ignore rules only apply to untracked files. Run git rm --cached on the file (or git rm -r --cached on a folder) and commit, and Git will stop tracking it while keeping your local copy.
They are based on the official github/gitignore repository, the same collection GitHub offers when you create a new repository, with long comment blocks removed to keep the file short.
Yes. Committing it means everyone working on the project ignores the same files. Personal rules for your own editor can go in a global ignore file instead.
For applications, commit package-lock.json, yarn.lock, composer.lock or Cargo.lock so every install uses the same versions. None of the templates in this generator ignore them.
Some browsers and operating systems hide or rename files that start with a dot. If the file is saved as gitignore or gitignore.txt, rename it to .gitignore.
Yes. Add the pattern to .git/info/exclude in your local repository. It works like .gitignore but is never committed or shared.