Skip to content
Toolcroft

Developer Tools

.gitignore Generator - Create .gitignore Files Instantly

Generate .gitignore files for Node, Python, Java, Go, Rust, and 15+ other languages, frameworks, and IDEs. Combine multiple templates in one click.

Languages

Frameworks

IDEs

Operating Systems

35 lines

How .gitignore works

A .gitignore file tells Git which files and directories to leave untracked. Git checks the file on every git status and git add operation. Patterns are matched against paths relative to the location of the .gitignore file.

Pattern syntax

  • *.log - ignore all .log files anywhere
  • /build/ - ignore only the top-level build/ directory
  • node_modules/ - ignore any node_modules directory at any depth
  • !important.log - negate a pattern (always track this file)
  • **/*.map - ignore any .map file at any depth
  • doc/**/*.txt - all .txt files under doc/

Already-tracked files

Adding a file to .gitignore does not automatically untrack it if Git is already tracking it. You must run:

git rm --cached <file>

to stop tracking a previously-committed file while keeping it on disk.

Global gitignore

For editor temp files and OS-specific files you never want tracked in any repository, use a global gitignore file. Configure it once:

git config --global core.excludesfile ~/.gitignore_global

Add entries like .DS_Store, Thumbs.db, .vscode/, *.swp (Vim swap files). This avoids polluting project-level .gitignore files with personal tooling exclusions.

Negation patterns

A pattern starting with ! negates a previous pattern - the file is tracked even if it would otherwise be ignored. Order matters: a negation must come after the pattern it overrides.

*.log
!important.log   # This IS tracked despite *.log rule above

A directory cannot be re-included if its parent is already ignored; you must unignore the parent first.