af1296754fe11bcafc49e1d4a0e2776faae52840
Some checks failed
CI / test (push) Failing after 12s
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
.gitignorefiles
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
- Create a new
.gitignorefile in the appropriate category directory undersrc/templates/ - Add the template to the
TEMPLATE_MAPinsrc/generator.py - Add detection patterns to
src/detector.pyif applicable - 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.
Languages
Python
100%