In this .gitignore generator, pick the languages, frameworks, editors and operating systems in your project and get one combined .gitignore file, with repeated patterns removed and each section labelled. Templates are based on the public-domain github/gitignore collection, plus a few for server work such as env files, logs and cPanel or DirectAdmin backups. Copy the result or download it; everything runs in your browser.
Loading the tool… It runs in your browser and needs JavaScript.
Table of Contents
How to use the generator
Search or browse the chips and click each template you need; click again to remove it. Sections appear in the order you pick them. Remove repeated patterns drops lines that an earlier section already contains, such as *.log or .env, except where a ! rule in between could change the meaning. Keep comments keeps the explanations from the original templates.
How .gitignore patterns work
- A pattern without a slash, such as
*.log, matches at any depth. - A leading slash anchors it to the folder of the .gitignore:
/vendor/only ignores the top-level vendor folder. - A trailing slash matches folders only, and
**matches any number of folders. - A line starting with
!re-includes something an earlier line ignored. Order matters, and you cannot re-include a file if its parent folder is ignored.
Check what Git ignores
Git can tell you which rule matched a path, which is the fastest way to debug a pattern:
git check-ignore -v storage/logs/laravel.log
git status --ignored
git rm -r --cached node_modules # stop tracking files that are already committed
git config --global core.excludesFile ~/.gitignore_globalA .gitignore only affects untracked files. If something is already committed, remove it from the index with git rm --cached and commit; it stays on disk. Editor and OS files such as .DS_Store, Thumbs.db or .idea/ are better placed in your global excludes file so every repository benefits.
For server admins
Template order matters only where negation rules are involved. If two sections disagree, the later rule wins, so pick the general templates first and the project-specific ones last. Review the combined file once: templates are written to suit most projects, and you may want to track something a template ignores, such as a .vscode/settings.json shared with your team.
When a site’s code lives in Git on a cPanel or DirectAdmin account, the home folder also holds backups, logs and panel files that must never be pushed. The cPanel / DirectAdmin backups template covers full-account backups (backup-*.tar.gz, cpmove-*.tar.gz), DirectAdmin user.*.tar.zst files, SQL dumps, error_log files and folders such as .cpanel/ and .trash/. Add Env files and secrets so .env stays out while .env.example is kept. If a secret was ever committed, rotate it: removing it from the latest commit does not remove it from history.
.gitignore Generator at a glance



Related: Git Cheat Sheet: Branches, Undo, Remotes and Deploys · Git Commands: 42 Everyday Commands with Examples · Diff Checker: Compare Two Texts.
Official documentation (checked 9 October 2026): Git documentation: gitignore · github/gitignore: README (CC0-1.0 licence)
Frequently asked questions
Why is a file still tracked after I added it to .gitignore?
.gitignore only applies to untracked files. Run git rm --cached on the file, commit, and Git will ignore it from then on.
Should I commit composer.lock or package-lock.json?
For applications, yes: the lock file makes installs repeatable. The templates leave lock files tracked.
Where do the templates come from?
Most come from the github/gitignore repository, which is in the public domain (CC0). Templates marked srvScripts in their tooltip were written for this tool.