Files
gitignore-generator/README.md
7000pctAUTO 40e0ab7a26
Some checks failed
CI / test (push) Has been cancelled
Initial commit: gitignore-generator v0.1.0
2026-02-01 03:31:28 +00:00

3.8 KiB

gitignore-generator

A CLI tool that automatically generates .gitignore files based on project type, tech stack, and IDE. It detects project structure, supports multiple languages/frameworks, generates IDE-specific ignores, allows customization via config file, and works offline with a curated collection.

Features

  • Auto-detects project type from file structure
  • Multi-language/framework support (Python, JavaScript, TypeScript, Java, Go, Rust, .NET, PHP, Ruby)
  • Framework-specific templates (Django, Flask, React, Vue, Angular, Rails, Laravel, Spring)
  • IDE-specific ignore rules (VS Code, JetBrains, Visual Studio Code)
  • Operating system-specific ignores (Linux, macOS, Windows)
  • Tool-specific templates (Docker, Gradle, Maven, Jupyter, Terraform)
  • Interactive wizard mode for guided generation
  • Configuration file support for customization
  • Works completely offline
  • Append or overwrite existing .gitignore files

Installation

pip install gitignore-generator

Or install from source:

git clone https://github.com/yourusername/gitignore-generator.git
cd gitignore-generator
pip install -e .

Usage

Auto-detect and generate

Automatically detect your project type and generate a .gitignore:

gitignore-generator generate

Specify types manually

Generate for specific types:

# Single type
gitignore-generator generate --language python

# Multiple types
gitignore-generator generate --language python --framework django --ide vscode

# Using positional arguments
gitignore-generator generate python django vscode

Output options

Write to stdout instead of file:

gitignore-generator generate python --stdout

Specify output file:

gitignore-generator generate python -o custom.gitignore

Overwrite existing file:

gitignore-generator generate python --overwrite

List available templates

# List all templates
gitignore-generator list

# List by category
gitignore-generator list --category language
gitignore-generator list --category framework
gitignore-generator list --category ide
gitignore-generator list --category os
gitignore-generator list --category tools

Detect project type

gitignore-generator detect

Interactive wizard

Run an interactive wizard for guided generation:

gitignore-generator wizard

Use configuration file

Specify a configuration file:

gitignore-generator --config .gitignorerc generate

Configuration

Create a .gitignorerc file in your project root or home directory:

custom_templates:
  my_template: |
    # Custom template content
    *.custom
    .custom/

default_types:
  - python
  - vscode

exclude_patterns:
  - "*.pyc"

include_patterns:
  python:
    - "src/"

Available Templates

Languages

  • Python
  • JavaScript
  • TypeScript
  • Java
  • Go
  • Rust
  • .NET
  • PHP
  • Ruby

Frameworks

  • Django
  • Flask
  • React
  • Vue
  • Angular
  • Ruby on Rails
  • Laravel
  • Spring

IDEs

  • VS Code
  • JetBrains
  • Visual Studio Code

Operating Systems

  • Linux
  • macOS
  • Windows

Tools

  • Docker
  • Gradle
  • Maven
  • Jupyter
  • Terraform

Development

Setup

git clone https://github.com/yourusername/gitignore-generator.git
cd gitignore-generator
pip install -e ".[dev]"

Running Tests

pytest tests/ -v
pytest tests/ --cov=src

Adding New Templates

  1. Create a new .gitignore file in the appropriate category directory under src/templates/
  2. Add the template to the TEMPLATE_MAP in src/generator.py
  3. Add detection patterns to src/detector.py if applicable
  4. Add tests in the appropriate test file

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.