# gitignore.in

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
<img width="735" alt="concept" src="https://github.com/gitignore-in/gitignore-in/assets/2596972/68cdeb1e-2b2b-4b01-9c2b-fc4286027e39">
`gitignore.in` is a Command Line Interface (CLI) tool that generates `.gitignore` from a template.
## Usage
Show the CLI help:
```bash
$ gitignore.in --help
```
Generate `.gitignore.in` if needed and build `.gitignore`:
```bash
$ 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.
```bash
$ 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.
```bash
$ gitignore.in infer --gibo Rust,macOS --gi node
```
Search available templates before adding them.
This matches template names case-insensitively by substring:
```bash
$ 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.
```bash
$ gitignore.in add rust macos node
```
Remove templates in the same way:
```bash
$ 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.
```bash
$ gitignore.in restore
```
## Installation
### Binary Releases
Download the binary from the [releases page](https://github.com/gitignore-in/gitignore-in/releases).
And place it in a directory that is in the PATH.
### Homebrew installation
```bash
$ brew tap gitignore-in/gitignore-in
$ brew install gitignore-in
```
## Manual Installation
```bash
$ git clone
$ cd gitignore-in
$ cargo install --path .
```
## License
MIT License