git-ignore
git-ignore is a small Rust CLI that fetches, lists, and patches .gitignore
templates — the usual "make me a .gitignore for Node, Rust, …" tool, plus
managed blocks inside your existing file. It is also a personal technical
study of what a CLI looks like when you build it around
gix (gitoxide) and
redb instead of shelling out to git or
walking thousands of files on disk.
|
Warning
|
This is a pet project used to learn and experiment with optimizations. It is not meant for production use or anything mission critical, use it at your own risk. |
How it works
Template registry — pull templates from several sources at once. The standard default git-ignore or your own personal template repository. It scans for
*.gitignorefiles.Embedded database — one
redbfile stores template contents keyed by their lowercasenamespace/name, alongside per-template upstream OIDs, soupdateonly downloads what actually changed since the last run.Marker-based patching — I use
git-ignore-start/git-ignore-endblocks for the marks inside your.gitignorethus other lines are stay untouched.
What I measured
Syscall counts via strace -c on a static x86_64-unknown-linux-musl
profiling build, against the default upstream (github/gitignore):
| Task | Command | Syscalls | Notes |
|---|---|---|---|
| List everything | git-ignore list |
39 | zero-copy rkyv memory map (down from 96) |
| Patch a file | git-ignore patch Node |
173 | parses and merges managed template blocks |
| System & DB info | git-ignore info |
304 | sources, git HEAD, table counts, SHA256 checks |
| Fresh upstream sync | git-ignore update -f |
3,663 | full git fetch, tree diffing, paged redb storage |
|
Note
|
A simple "hello world" in some languages can burn over 300 syscalls just to run |
Try it
Requires Rust (nightly recommended for fully static builds) and
just for the build recipes:
cargo build --release
Links
- Repository: https://github.com/zerosign/git-ignore
- Built with gix and redb