A small, dependency-free command-line tool that looks at what's actually in
your project directory and generates (or updates) a .gitignore to match —
no need to go copy-paste one from a website.
Most .gitignore generators are a web form. This one runs locally, scans
for marker files (package.json, pyproject.toml, go.mod, ...), and
writes only what's relevant. Run it again later after adding a new stack
and it'll top up the file instead of clobbering it.
pip install .This installs a gitignore-gen command on your PATH.
gitignore-gen # scan the current directory
gitignore-gen path/to/repo # scan a specific directoryExample output:
gitignore-gen: added 12 line(s) to ./.gitignore
Running it again once the file already covers everything detected:
gitignore-gen: .gitignore already covers everything detected — nothing to add
| Flag | Description |
|---|---|
--dry-run |
Print what would be added without writing the file |
--list-templates |
List available templates and the markers that trigger them |
Python, Node, Java, Go, Rust, Ruby — plus a universal section (OS files,
editor directories, .env) that's always included. Run
gitignore-gen --list-templates to see exactly which files trigger which
section.
Existing .gitignore content is never removed or reordered — new lines are
only appended, under a clearly marked # --- added by gitignore-gen ---
section, and only if they aren't already present somewhere in the file.
pip install -e .
python -m unittest discover -s tests -vAll rights reserved. This code is public for viewing and reference only — no license is granted to use, copy, modify, or redistribute it. See LICENSE for details.