.gitignore Generator — Templates for Every Language & IDE
Combine .gitignore templates for languages, frameworks, editors and operating systems into one clean file.
### Node.js ### # Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* lerna-debug.log* .pnpm-debug.log* # Runtime data pids *.pid *.seed *.pid.lock # Coverage coverage *.lcov .nyc_output # Dependencies node_modules/ jspm_packages/ bower_components # Caches .npm .eslintcache .stylelintcache .cache .parcel-cache *.tsbuildinfo .node_repl_history *.tgz # Yarn .yarn/cache .yarn/unplugged .yarn/build-state.yml .yarn/install-state.gz .pnp.* # Environment .env .env.* !.env.example # Build output dist build out ### macOS ### # General .DS_Store .AppleDouble .LSOverride # Custom folder icons (the real file name is "Icon" followed by a carriage return) Icon? # Thumbnails ._* # Files that might appear in the root of a volume .DocumentRevisions-V100 .fseventsd .Spotlight-V100 .TemporaryItems .Trashes .VolumeIcon.icns .com.apple.timemachine.donotpresent # Directories potentially created on remote AFP share .AppleDB .AppleDesktop Network Trash Folder Temporary Items .apdisk ### Windows ### # Windows thumbnail cache files Thumbs.db Thumbs.db:encryptable ehthumbs.db ehthumbs_vista.db # Dump file *.stackdump # Folder config file [Dd]esktop.ini # Recycle Bin used on file shares $RECYCLE.BIN/ # Windows Installer files *.cab *.msi *.msix *.msm *.msp # Windows shortcuts *.lnk ### Visual Studio Code ### .vscode/* !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json !.vscode/*.code-snippets # Local History for Visual Studio Code .history/ # Built Visual Studio Code Extensions *.vsix
Browsers often save a dot-file download as “gitignore.txt”; rename it to exactly .gitignore in your project root.
Runs entirely in your browser. The templates are bundled with the page; nothing is fetched or sent. Browse all free tools.
Found a problem, or something that could be better? We read every message and we fix things quickly.
This .gitignore generator builds a .gitignore file from templates for the languages, frameworks, editors and operating systems in your project. Pick Node.js, Python, Unity, JetBrains, macOS or any of the 60-plus others, or start from a stack such as “Next.js app”, and the templates are merged into one file with a header per section. Patterns that appear in more than one template are written once.
The templates are written from the widely used github/gitignore collection, trimmed of long comment blocks, and bundled with the page, so it works offline and nothing about your project is sent anywhere. Removing duplicates is done carefully because .gitignore is order-sensitive: once a template re-includes something with a “!” rule, later duplicates are kept rather than risk changing what is ignored. A .gitignore only affects untracked files; see the FAQ for files Git already tracks.
How to use
- Click a quick-start stack, or search for templates and tick the ones your project uses: language, framework, editor and operating system.
- Remove any you do not need with the × on its chip.
- Add project-specific rules, such as an uploads/ directory, in “Your own rules”.
- Copy the result, or download it and save it as .gitignore in the root of your repository.
- Commit it: git add .gitignore && git commit -m "Add .gitignore".
Frequently asked questions
Why is a file still tracked after I added it to .gitignore?
A .gitignore only stops untracked files from being added. If Git already tracks the file, it keeps tracking it. Remove it from the index without deleting it from disk with git rm --cached path/to/file (or git rm -r --cached folder/), then commit. If it contained a secret, the secret is still in your history and should be rotated.
Should I commit the .gitignore file?
Yes. It belongs in the repository so everyone who clones the project ignores the same build output and dependency folders. Rules that only apply to you, such as your editor’s files, can go in .git/info/exclude for one repository or in a global ignore file set with git config --global core.excludesFile ~/.gitignore_global.
Should package-lock.json or yarn.lock be ignored?
No, for applications commit the lock file. It records the exact dependency versions that were tested, so every install and every CI run gets the same tree. The same applies to poetry.lock, Pipfile.lock, Cargo.lock for binaries, Gemfile.lock and composer.lock. None of the templates here ignore them.
What do the patterns mean?
A trailing slash (build/) matches only directories. A leading slash (/build) anchors the pattern to the directory containing the .gitignore. * matches anything except a slash, ** matches across directories (logs/**/*.log), and ? matches one character. A line starting with ! re-includes something an earlier pattern excluded, and # starts a comment, but only at the start of a line.
Why does my negation (!) rule not work?
Git cannot re-include a file if one of its parent directories is excluded, because it never looks inside an ignored directory. Instead of ignoring the folder (logs/), ignore its contents (logs/*) and then re-include the file (!logs/.gitkeep). Order also matters: the ! line has to come after the pattern it overrides.
Can I check why a file is ignored?
Yes: git check-ignore -v path/to/file prints the .gitignore file, line number and pattern that matched. git status --ignored lists every ignored file in the working tree.
What belongs in a .gitignore
• Dependencies that a package manager reinstalls: node_modules/, vendor/, .venv/, Pods/.
• Build output and caches: dist/, build/, target/, .next/, __pycache__/, *.class, coverage reports.
• Local secrets and environment files: .env, *.pem, credentials JSON. Commit a .env.example with placeholder values instead.
• Editor and OS clutter: .DS_Store, Thumbs.db, .idea/, most of .vscode/.
• Logs, crash dumps and local databases: *.log, *.sqlite (unless the database is a deliberate fixture).
Keep in the repository: source, lock files, configuration that every developer needs, and shared editor settings such as .vscode/extensions.json, which the VS Code template deliberately re-includes.
Where Git looks for ignore rules
Git combines several sources, from highest to lowest priority: patterns given on the command line; .gitignore files in the same directory as the path and then each parent directory up to the repository root (a .gitignore in a subdirectory applies only below it); .git/info/exclude, which is local and never committed; and the global file named by core.excludesFile, which defaults to ~/.config/git/ignore. Put operating-system and editor rules in the global file if you would rather keep project .gitignore files about the project.
Related free tools
- Chmod Calculator — Tick read, write and execute boxes to get the octal mode and chmod command, or decode 755, 644 and rwxr-xr-x.
- Docker Run ⇄ Compose — Turn a docker run command into a docker-compose.yml service, or a Compose service back into docker run.
- Regex Tester — Test a regular expression against sample text with live match highlighting, capture groups and replace preview. Free, in your browser.
- JSON Formatter — Pretty-print, minify and validate JSON, with parse errors located by line and column. In your browser, no upload.