# `Git.Commands.Gc`
[🔗](https://github.com/joshrotenberg/git_wrapper_ex/blob/main/lib/git/commands/gc.ex#L1)

Implements the `Git.Command` behaviour for `git gc`.

Cleans up unnecessary files and optimizes the local repository.

# `t`

```elixir
@type t() :: %Git.Commands.Gc{
  aggressive: boolean(),
  auto: boolean(),
  force: boolean(),
  keep_largest_pack: boolean(),
  no_prune: boolean(),
  prune: String.t() | nil,
  quiet: boolean()
}
```

# `args`

```elixir
@spec args(t()) :: [String.t()]
```

Returns the argument list for `git gc`.

## Examples

    iex> Git.Commands.Gc.args(%Git.Commands.Gc{})
    ["gc"]

    iex> Git.Commands.Gc.args(%Git.Commands.Gc{aggressive: true})
    ["gc", "--aggressive"]

    iex> Git.Commands.Gc.args(%Git.Commands.Gc{auto: true})
    ["gc", "--auto"]

    iex> Git.Commands.Gc.args(%Git.Commands.Gc{prune: "now"})
    ["gc", "--prune=now"]

    iex> Git.Commands.Gc.args(%Git.Commands.Gc{no_prune: true})
    ["gc", "--no-prune"]

    iex> Git.Commands.Gc.args(%Git.Commands.Gc{quiet: true, force: true})
    ["gc", "--quiet", "--force"]

    iex> Git.Commands.Gc.args(%Git.Commands.Gc{keep_largest_pack: true})
    ["gc", "--keep-largest-pack"]

# `parse_output`

```elixir
@spec parse_output(String.t(), non_neg_integer()) ::
  {:ok, :done} | {:error, {String.t(), non_neg_integer()}}
```

Parses the output of `git gc`.

On success (exit code 0), returns `{:ok, :done}`. On failure, returns
`{:error, {stdout, exit_code}}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
