gitignore-in 0.2.1

A command line tool for managing .gitignore files with gitignore.in
gitignore-in-0.2.1 is not a library.

gitignore.in

Coverage

Website: https://gitignore.in/

Motivation

The method of generating .gitignore from a template is already widespread. For example, there are the following methods.

  • gibo
  • gitignore.io
  • .gitignore generated when creating a repository on GitHub

However, the .gitignore file generated by these methods is not updated over time. The result of gibo dump Python executed in 2018 and the result of gibo dump Python executed in 2023 will be different. In order for the project to use the latest .gitignore, you need to update .gitignore regularly. However, this is a troublesome task that can cause mistakes.

Solution

gitignore.in is a Command Line Interface (CLI) tool that generates .gitignore from a template.

Usage

Show the CLI help:

$ gitignore.in --help

Generate .gitignore.in if needed and build .gitignore:

$ gitignore.in

If .gitignore.in does not exist but .gitignore already exists, gitignore.in first infers a starting .gitignore.in and then rebuilds .gitignore.

In the .gitignore.in file, write the template you want to use like shell script.

$ cat .gitignore.in
# See https://gitignore.in/
# Edit this file and run `gitignore.in` to rebuild .gitignore

# This is a comment
gibo dump Linux
gibo dump macOS
gibo dump Windows
gibo dump Python
echo '.coverage'
echo '.env'

When you run gitignore.in again, .gitignore will be updated.

If you already have a .gitignore, you can infer a starting .gitignore.in from it.

$ gitignore.in infer --gibo Rust,macOS --gi node

Search available templates before adding them. This matches template names case-insensitively by substring:

$ gitignore.in search macos rust

Add templates without worrying about gibo vs gi. gitignore.in resolves names case-insensitively, prefers the provider already used in .gitignore.in, and rebuilds .gitignore after the update.

$ gitignore.in add rust macos node

Remove templates in the same way:

$ gitignore.in remove RUST Node

This infer mode is heuristic. It tries to cover the existing .gitignore with the specified gibo dump ... and gi ... candidates, then falls back to echo '...' for unmatched lines. If you omit both --gibo and --gi, it checks all available templates from both providers.

If the .gitignore was already generated by gitignore.in, you can restore .gitignore.in from its embedded section headers.

$ gitignore.in restore

Installation

Binary Releases

Download the binary from the releases page. And place it in a directory that is in the PATH.

Homebrew installation

$ brew tap gitignore-in/gitignore-in
$ brew install gitignore-in

Manual Installation

$ git clone
$ cd gitignore-in
$ cargo install --path .

License

MIT License