Auto-Gitignore CLI

A Python CLI tool that automatically generates .gitignore files by detecting project type, language, and framework from project files.

Features

  • Auto-detection: Automatically detects languages (Python, Node.js, Go, Java, etc.) and frameworks (Django, React, FastAPI, Flask, etc.)
  • Comprehensive Patterns: Includes patterns for 19+ programming languages and 22+ frameworks
  • IDE Support: Generates patterns for VSCode, JetBrains, PyCharm, and other IDEs
  • OS Patterns: Includes macOS, Windows, and Linux specific ignores
  • Custom Patterns: Support for adding custom patterns via CLI
  • Pattern Merging: Handles monorepos and mixed projects with deduplication

Installation

From Source

pip install -e .

Using pip

pip install auto-gitignore-cli

Quick Start

Generate a .gitignore for your current directory:

auto-gitignore

Generate for a specific directory:

auto-gitignore --path /path/to/project

Dry-run to preview without writing:

auto-gitignore --dry-run

Usage

auto-gitignore [OPTIONS]

Options

Option Description
--path, -p Path to project directory (default: current directory)
--language, -l Force specific language(s)
--framework, -f Add framework-specific patterns
--ide Add IDE-specific patterns
--os Add OS-specific patterns
--custom, -c Add custom pattern(s)
--output, -o Custom output file path
--merge/--no-merge Merge patterns from multiple sources (default: True)
--dry-run Show generated content without writing
--force Overwrite existing .gitignore
--verbose, -v Show detected stack and details
--help Show help message

Examples

Detect and generate for Python project

auto-gitignore --language python

Add Django and React patterns

auto-gitignore --framework django --framework react

Include IDE and OS patterns

auto-gitignore --ide vscode --ide jetbrains --os macos --os windows

Add custom patterns

auto-gitignore --custom "custom_dir/" --custom "*.custom"

Save to custom location

auto-gitignore --output ~/.gitignore-global

Verbose mode with full detection info

auto-gitignore --verbose

Supported Languages

  • Python
  • Node.js
  • Go
  • Java
  • Rust
  • C#
  • C/C++
  • Ruby
  • PHP
  • Dart
  • Swift
  • Kotlin
  • Scala
  • Perl
  • R
  • Elixir
  • Clojure
  • Lua
  • Haskell

Supported Frameworks

Python

  • Django
  • Flask
  • FastAPI

JavaScript/TypeScript

  • React
  • Vue
  • Angular
  • Express
  • Next.js
  • Nuxt
  • Svelte
  • Gatsby
  • Astro
  • SvelteKit
  • Remix
  • Vite
  • NestJS

Go

  • Gin

Java

  • Spring

Ruby

  • Rails

PHP

  • Laravel

.NET

  • .NET/C#

IDE Support

  • VSCode
  • JetBrains (IntelliJ, PyCharm, WebStorm, etc.)
  • Eclipse
  • NetBeans
  • Sublime Text
  • Vim
  • Emacs
  • Atom
  • Spacemacs

Configuration

No configuration file required. All options can be passed via CLI flags.

Development

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/ -v

# Run with coverage
pytest tests/ --cov=src --cov-report=term-missing

# Type checking
mypy src/

# Linting
ruff check .

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests: pytest tests/ -v
  5. Submit a pull request

License

MIT

Description
A Python CLI tool that automatically generates .gitignore files by detecting project type, language, and framework from project files.
Readme MIT 71 KiB
2026-02-01 20:17:26 +00:00
Languages
Python 100%