Version Control & Repository Hygiene

Git .gitignore Templates Directory

Curated, battle-tested `.gitignore` templates for every major programming language, web framework, operating system, and cloud tool. Keep repository sizes slim, eliminate merge conflicts, and prevent leaking secret credentials.

Languages & Frameworks46 lines

Node.js .gitignore Template

Standard .gitignore for Node.js, npm, yarn, and pnpm projects. Ignores dependencies, runtime logs, build output, and local environment files.

View Details
Languages & Frameworks59 lines

Python .gitignore Template

Comprehensive Python .gitignore ignoring bytecode (__pycache__), virtual environments (venv, .venv), distribution builds, and test artifacts.

View Details
Languages & Frameworks30 lines

React & Next.js .gitignore Template

Tailored .gitignore for Next.js and React web apps. Ignores .next build caches, static exports, Vercel deployments, and local env variables.

View Details
Languages & Frameworks26 lines

Go (Golang) .gitignore Template

Clean .gitignore for Go projects ignoring compiled architecture binaries, coverage profiles, and local vendor folders.

View Details
Languages & Frameworks11 lines

Rust & Cargo .gitignore Template

Standard .gitignore for Rust projects ignoring the entire /target directory and debug symbol files.

View Details
Languages & Frameworks38 lines

Java (Maven & Gradle) .gitignore Template

Standard .gitignore for Java applications built with Apache Maven or Gradle, ignoring target and build directories.

View Details
Operating Systems19 lines

macOS System Files (.DS_Store) .gitignore Template

Global .gitignore rules for Apple macOS files including .DS_Store, AppleDouble, Spotlight indexing, and icon metadata.

View Details
IDEs & Editors23 lines

Visual Studio Code & JetBrains IDE .gitignore Template

Rules for editor configurations: ignores personal window state and workspace caches while allowing shared team settings.

View Details
DevOps & Cloud27 lines

Terraform .gitignore Template

Critical .gitignore for HashiCorp Terraform preventing cloud credential leaks (.tfstate, .tfvars) and ignoring provider cache.

View Details
DevOps & Cloud31 lines

Docker (.dockerignore) Template

Essential .dockerignore template to speed up docker build context, reduce image size, and prevent leaking .git and .env into container images.

View Details

.gitignore Pattern Syntax Cheatsheet

Mastering glob patterns, directory matching, and rule negations

PatternMatching BehaviorExample Matches
node_modules/Matches directory only (and all contents recursively)Any folder named node_modules at any depth
*.logWildcard matching any file ending in .logerror.log, debug.log, npm-debug.log
/buildLeading slash pins match strictly to the repository rootMatches /build, but ignores /packages/api/build
**/tempDouble asterisk matches zero or more leading directoriestemp, a/temp, a/b/c/temp
!important.logExclamation mark negates ignore rule (forces file tracking)Re-includes important.log even if *.log is ignored

Frequently Asked Questions About .gitignore Files

Frequently Asked Questions

Frequently Asked Questions

Everything you need to know regarding specifications, syntax, and security best practices.

Git continues tracking files that were already committed before the .gitignore rule was added. To untrack them without deleting your local files, run: `git rm -r --cached . && git add . && git commit -m "Untrack ignored files"`.