gitignore Templates: What Each Stack Ignores and Why
One page per template in the generator, built from the same pattern list the tool outputs, so a page can never describe a rule the tool no longer produces. Each one explains what the ignored paths actually are, why committing them causes trouble, and where the template takes a side on a judgement call, such as whether a lockfile belongs in the repository. Every page ends with the literal file the generator would give you.
Every page here embeds the .gitignore Generator. Pick one or more templates, tick the common additions you want, and copy or download the combined .gitignore.
54 pages in this section.
Category Language
JavaScript .gitignore template
Every rule in the JavaScript .gitignore template explained: why node_modules is restored rather than committed, and what the old package folders catch.
TypeScript .gitignore template
The TypeScript template ignores compiled output, source maps and build info, but its *.d.ts rule is broader than most projects want. Here is each line.
Python .gitignore template
A line by line read of the Python .gitignore template: bytecode caches, virtual environments, packaging output, test caches and the lib/ rule that bites.
Java .gitignore template
What the Java .gitignore template ignores: compiled classes, packaged archives, crash dumps, and the negations that keep the Gradle wrapper jar tracked.
Go .gitignore template
The Go template ignores platform binaries by extension, which misses the extensionless binary go build produces on Linux and macOS. Here is what to add.
Rust .gitignore template
The Rust template ignores the target directory and leaves Cargo.lock tracked. Whether that is right depends on whether you ship a binary or a library.
C .gitignore template
What the C .gitignore template covers: object files, static and shared libraries, linker maps, debug symbols and the patterns that swallow a vendored binary.
C++ .gitignore template
The C++ template adds CMake output to the usual compiler artefacts, and its Makefile rule will ignore a hand written Makefile. Here is what each line covers.
C# .gitignore template
Why the C# template writes [Bb]in instead of bin, what the NuGet and Visual Studio rules cover, and which per developer files it keeps out of the repository.
Ruby .gitignore template
The Ruby template anchors most rules to the repository root with a leading slash, and ignores Gemfile.lock, which is right for a gem and wrong for an app.
PHP .gitignore template
The PHP template ignores the vendor directory and the .env file, and also ignores composer.lock, which most application projects should commit instead.
Swift .gitignore template
What the Swift template ignores: the package build folder, Xcode user state, derived data and symbol archives, plus the Package.resolved decision it makes.
Kotlin .gitignore template
The Kotlin template covers the same class and archive output as Java, plus the .kotlin session directory the newer compiler writes into the project root.
Dart .gitignore template
The Dart template ignores the tool directory, generated docs and compiled JavaScript output, and ignores pubspec.lock, which an application should commit.
Scala .gitignore template
What the Scala template ignores: the target output directory, the build server protocol folder, and the caches that Metals and Bloop keep inside the project.
R .gitignore template
The R template ignores saved workspaces, session history, rendered vignettes and check output, plus the .httr-oauth file that stores live access tokens.
Lua .gitignore template
A short template for a short toolchain: compiled bytecode from luac, packaged rock archives, and the local tree LuaRocks installs dependencies into.
Perl .gitignore template
The Perl template ignores the build library tree, generated metadata and coverage output, and its Makefile rule will also match a Makefile you wrote yourself.
Haskell .gitignore template
What the Haskell template covers: object and interface files, the dist output directories, profiling and event log output, and the local project overrides.
Elixir .gitignore template
The Elixir template anchors its rules to the project root and ignores compiled beam files, fetched dependencies, crash dumps and the secret config convention.
Jupyter Notebook .gitignore template
The Jupyter template ignores autosave checkpoints and profile folders, but the real problem with notebooks in git is the output cells, which no rule fixes.
Category Framework
Laravel .gitignore template
The Laravel template ignores environment files, application keys, compiled assets and editor folders, and it is the most secret aware template here.
Node.js .gitignore template
The longest JavaScript oriented template: dependency directories, every package manager's debug log, bundler caches, env files and Yarn Plug'n'Play state.
React .gitignore template
A short template built around one idea: the .env.local family is per developer and never committed, while the plain .env is shared and usually should be.
Next.js .gitignore template
What the Next.js template ignores: the build cache, the static export folder, deployment state, and one wildcard that covers every local environment file.
Vue .gitignore template
The Vue template ignores build output and local environment files, and is one of the few that also carries operating system and editor rules of its own.
Angular .gitignore template
The Angular template ignores compiled output, the type checker's intermediate folder, the local build cache, and logs older test tooling leaves behind.
Django .gitignore template
The Django template adds four framework rules to the usual Python ones: local settings, the SQLite database, uploaded media and collected static files.
Flask .gitignore template
The Flask template adds the instance folder to the usual Python rules, which is the framework's designated place for configuration that must not be committed.
Rails .gitignore template
The Rails template is built around the encrypted credentials system: the encrypted file is committed, the key that decrypts it never is. Every rule explained.
Spring Boot .gitignore template
The Spring Boot template covers both build tools at once and adds sections for three IDEs, which makes it broad but leaves application secrets uncovered.
.NET .gitignore template
The .NET template covers bin, obj and NuGet output, and ignores launchSettings.json, which holds the launch profiles and environment variables for local runs.
Flutter .gitignore template
The Flutter template adds generated plugin manifests and per platform build artefacts to the Dart rules, including the iOS pod directory and build modes.
Unity .gitignore template
The Unity template ignores the import cache, temporary build state and the IDE project files the editor regenerates, using bracket classes for case safety.
Unreal Engine .gitignore template
The Unreal template ignores compiled binaries, the intermediate build tree, the derived data cache and the saved directory, plus generated project files.
Category IDE
VS Code .gitignore template
This template ignores the .vscode folder's contents but keeps five files back on purpose, which is the clearest statement of the commit or ignore argument.
IntelliJ IDEA .gitignore template
The IntelliJ template ignores the whole .idea directory and the module files, which is simpler than the alternative and loses some settings worth sharing.
Eclipse .gitignore template
The Eclipse template ignores the project descriptor, classpath file and settings folder, which is right for a build tool project and wrong without one.
Vim .gitignore template
The Vim template uses character ranges to catch every swap file extension the editor cycles through, plus sessions, undo history and the netrw history.
Emacs .gitignore template
The Emacs template covers tilde backup files, the hash delimited auto save files, the symbolic lock files and compiled Lisp, plus per project tooling state.
Sublime Text .gitignore template
The Sublime template separates the project file from the workspace file, and covers sftp-config.json, which stores upload credentials in plain text.
Xcode .gitignore template
The Xcode template ignores the project bundle's contents while keeping the project file and shared data, the only way to share schemes but not sessions.
Android Studio .gitignore template
The Android Studio template ignores local.properties, which names the SDK path on one machine, along with build output, captures and native build directories.
Category OS
macOS .gitignore template
Where .DS_Store actually comes from, why it appears in folders nobody edited, and what the rest of the macOS template covers on network and removable volumes.
Windows .gitignore template
What the Windows template covers: the thumbnail caches Explorer writes into image folders, the folder view settings file, and installer package extensions.
Linux .gitignore template
The shortest template in the collection. Five rules covering editor backup files, file manager settings, per volume trash and NFS silly rename files.
Category Build Tool
Gradle .gitignore template
Six rules covering the Gradle cache and build directories, with negations that keep the wrapper jar and properties tracked because a clone needs both.
Maven .gitignore template
The Maven template ignores the target directory and the backup files the release plugin leaves behind, including the wrapper jar that Gradle keeps.
npm .gitignore template
This template ignores package-lock.json, which contradicts the current advice to commit the lockfile. Here is what the rest of it covers and what to change.
Yarn .gitignore template
The Yarn template ignores the .yarn directory's contents while negating five subdirectories, because which ones you keep depends on the install mode you use.
pnpm .gitignore template
The shortest package manager template, because pnpm keeps its content addressed store outside the project and links into it rather than copying packages.
Category Infrastructure
Docker .gitignore template
A small template with two rules worth questioning: it ignores .dockerignore, and it ignores every compose file except two, which suits few projects.
Terraform .gitignore template
State files contain secrets in plain text and must never be committed. This template covers that, and also ignores the lock file, which should be tracked.
Vagrant .gitignore template
Two rules worth understanding: the .vagrant directory holds machine identifiers and a generated private key, and box files are multi gigabyte disk images.