There are a gazillion packages in pypi.org that "build" your .gitignore files.
The problem is, all download templates from a repository or another, and you need to instruct them to do so.
You could also ask your LLM to do it claude -p "update the .gitignore make it complete" or codex -p "update the .gitignore make it complete" but why would you waste tokens on something so simple?
So as far as I can tell we all still do it pretty much manually, piercing things from here and then, and then reusing them.
I build gitignorio-cli (command: gi) which does the .gitignore for your system, your project languages and the editor you are using automatically.
You don't need to do anything other than installing it with:
pipx install gitignorio-cli
Once installed, you run:
gi create
or if you are updating the file for a project that already has one
gi update
This leaves all your changes in, and appends in the end.
Or if you are adding something else, and you want to feel like you are contributing to it (but it is unnecessary) you can run gi add LANG/SYSTEM/EDITOR
The way this works is:
(1) It uses Linguist which is the same thing Github uses to show you the languages in a package.
(2) Then runs magika in case Linguist has missed anything.
(3) Creates the .gitignore for the languages it has found, the system it is in, and any other files/folders that should be ignored.
And that is it.
Now you can also pass it into a tool caller as a default for your project setup, so if an LLM is building the whole project just needs to use the tool-call with gi as the parameter and can do this with using almost no tokens.
As a last note, the package also ships with hooks you can install so it runs automatically and your .gitignore is always up to date.
Happy (less annoying) coding/prompting!
Top comments (0)