#gitignore #template #git #aliases #io #node #quickly

app git-ignore-generator

Quickly and easily fetch .gitignore templates from www.gitignore.io

14 releases (stable)

1.3.3 Feb 21, 2024
1.2.2 Oct 21, 2022
1.2.0 Dec 9, 2021
1.1.2 Mar 24, 2021
0.2.0 Nov 22, 2018

#94 in Development tools

Download history 318/week @ 2024-02-15 177/week @ 2024-02-22 36/week @ 2024-02-29 4/week @ 2024-03-07 3/week @ 2024-03-14 82/week @ 2024-03-28 57/week @ 2024-04-04

210 downloads per month


870 lines


GitHub Actions Status Crates

Create .gitignores with templates from www.gitignore.io, your own aliases and templates

  • Simple: git ignore node to print the node template.
  • Offline first: Automatically caches templates for offline support.
  • Aliases, templates: Create aliases for commonly combined templates, or make your own custom ones.
  • Magic: Automatically generate your .gitignore by matching common files against templates.
Table of Contents

What and why

Tired of visiting gitignore.io to get templates for your .gitignore all the time? I was. So I automated it.

git ignore allows you to easily and quickly get all the available templates from gitignore.io, even while offline. You can also define your own aliases for common combinations of templates, or create your own completely custom ones for even more power.




NOTE: Similar to the nix-search command, this program prints a message to stderr about using cached results. This does not interfere with piping and is purely informational.

Updating templates

To download and cache all available templates, use --update. This can also be used in combination with any of the other flags/arguments, or be run as a standalone flag.

$ git ignore -u
Info: Update successful

Automatic matching

By matching against project or language specific files and extensions you can have your .gitignore automatically generated for you. Do you have a package.json and Cargo.toml in the current directory? --auto will automatically add node and rust to the template output.

$ git ignore -a

### Created by https://www.gitignore.io
### Rust ###


# These are backup files generated by rustfmt

List templates

To list all the available templates:

$ git ignore --list

The --list option is also used to search for templates matching your input. The matching is done by doing template.contains(phrase), so searching for intellij will list all templates containing that phrase. You can also search for multiple templates at once:

$ git ignore -l rust intellij


Printing templates

Once you've found your templates, you can print them by omitting -l|--list. Note: listing and searching for templates is inexact, but printing them requires exact matches.

$ git ignore rust intellij+all

### Created by https://www.gitignore.io
### Rust ###


# These are backup files generated by rustfmt


Aliases are a way to combine common combinations of templates, if you find yourself always using node and visualstudiocode in your frontend projects you can create an alias for it for ease of access. Aliases have higher priority than templates from www.gitignore.io, so an alias named node will be used instead of the template. When listing all available templates, aliases are colored yellow to allow you to distinguish them from regular templates.


$ git ignore alias list
Available aliases:
node => ["node", "nextjs", "visualstudiocode"]
rust => ["rust", "intellij+all"]


$ git ignore alias add node node nextjs visualstudiocode
Created alias node for ["node", "nextjs", "visualstudiocode"]


$ git ignore alias remove node
Removed alias node


Templates are custom templates created by you for things that do not have an existing template defined. When listing and searching templates has the highest priority (templates > alias > normal). Templates are listed with a blue color to distinguish them from aliases and normal templates.


The file name is the name of the file in $HOME/.config/git-ignore/templates.

$ git ignore template list
Available templates:
docs => "docs.txt"


All templates are created in $HOME/.config/git-ignore/templates. So the name you give for the file is the filename that is used in this directory.

$ git ignore template add docs docs.txt
Created template docs at ~/.config/git-config/templates/docs.txt


$ git ignore template remove node
Removed template node


You can create the configuration file and directories by running git ignore init. This will create $HOME/.config/git-ignore/config.toml and $HOME/.config/git-ignore/templates/.

The config file is a simple TOML file:

node = [

docs = 'docs.txt'


If your method of installation didn't include shell completion, you can manually source or save them with the git ignore completion <shell> command.


Finally, help is always available with git ignore help/git ignore -h (or --help if your installation included man pages).


Currently, the package is available a couple of places, including Homebrew, AUR and Nix.

cargo install git-ignore-generator
nix-env -iA nixpkgs.gitAndTools.git-ignore
  1. brew tap sondr3/homebrew-taps
  2. brew install git-ignore
Arch (replace paru with you favorite AUR tool)
paru git-ignore-bin
paru git-ignore

Release pages

You can also download the matching release from the release tab, extracting the archive and placing the binary in your $PATH. Note that for Linux the unknown-linux-musl.tar.gz is preferred as it is statically linked and thus should run on any Linux distribution.




~186K SLoC