f1400341564d9fb789c5311acbc1cdf0d76c0a53
Gitignore Generator
A CLI tool that generates optimized .gitignore files with support for 50+ frameworks, IDE-specific templates, interactive custom builders, template management, and syntax validation. All processing is done locally with zero network dependencies.
Features
- 50+ Language/Framework Templates - Python, JavaScript, Java, Go, Rust, C++, C#, Ruby, PHP, TypeScript, Swift, Kotlin, Scala, Dart, and more
- IDE-Specific Templates - VSCode, JetBrains (IntelliJ, PyCharm), Visual Studio, Vim, Emacs
- Interactive Mode - Wizard-style interface for building custom .gitignore files
- Template Management - Add, remove, export custom templates
- Syntax Validation - Detects common mistakes and potential issues
- Local-First - All processing done locally, no network dependencies
Installation
From Source
pip install -e .
From PyPI
pip install gitignore-generator
Usage
Generate a .gitignore from templates
gitignore generate python
gitignore generate python javascript
gitignore generate python --ide vscode
gitignore generate python -o my.gitignore
List available templates
gitignore list
gitignore list --category languages
gitignore list --category ides
Search for templates
gitignore search python
gitignore search java
Interactive Mode
gitignore interactive
Validate existing .gitignore
gitignore validate .gitignore
Template Management
# Add custom template
gitignore template-add my_template template_file.gitignore
# Remove custom template
gitignore template-remove my_template
# Export template to file
gitignore template-export python exported.gitignore
# Get template info
gitignore info python
Commands
| Command | Description |
|---|---|
generate [TEMPLATES...] |
Generate .gitignore from templates |
list |
List available templates |
search QUERY |
Search for templates |
interactive |
Launch interactive wizard |
validate FILE |
Validate .gitignore syntax |
template-add NAME FILE |
Add custom template |
template-remove NAME |
Remove custom template |
template-export NAME FILE |
Export template to file |
info TEMPLATE |
Show template information |
Templates
Languages & Frameworks
- Python, JavaScript, Java, Go, Rust
- C++, C#, TypeScript, PHP, Ruby
- Swift, Kotlin, Scala, Dart
- Haskell, Elixir, Clojure, OCaml
- Perl, Lua, R
- .NET, Terraform, Ansible
- Docker, Kubernetes
IDEs
- VSCode, JetBrains (IntelliJ, PyCharm, etc.)
- Visual Studio, Vim, Emacs
Interactive Mode
The interactive mode guides you through creating a .gitignore:
- Select a category (Languages, IDEs, or Custom)
- Choose templates from the list
- Add custom patterns
- Preview and edit the result
- Save to file
Template Management
Custom templates are stored in ~/.config/gitignore-generator/templates/.
Environment Variables
| Variable | Description | Default |
|---|---|---|
GITIGNORE_DEFAULT_FILE |
Default output file | .gitignore |
TEMPLATE_DIR |
Template directory | templates |
Examples
Python project with VSCode
gitignore generate python --ide vscode
Full stack project
gitignore generate python javascript --ide jetbrains
With custom output
gitignore generate .gitignore - java kotlin -of
Configuration
Create a .gitignore-generator/config.yaml:
template_dir: templates
default_output: .gitignore
custom_templates_dir: ~/.config/gitignore-generator/templates
Contributing
- Fork the repository
- Create a feature branch
- Add your template to
templates/languages/ortemplates/ides/ - Update
templates/templates.json - Run tests:
pytest tests/ -v - Submit a pull request
License
MIT
Languages
Python
100%