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

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

Supports `--soft`, `--mixed` (default), and `--hard` modes against any
git ref (defaults to `HEAD`).

# `mode`

```elixir
@type mode() :: :soft | :mixed | :hard
```

# `t`

```elixir
@type t() :: %Git.Commands.Reset{mode: mode(), ref: String.t()}
```

# `args`

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

Returns the argument list for `git reset`.

Builds `git reset --<mode> <ref>` from the struct fields. The mode defaults
to `:mixed` and the ref defaults to `"HEAD"`.

## Examples

    iex> Git.Commands.Reset.args(%Git.Commands.Reset{})
    ["reset", "--mixed", "HEAD"]

    iex> Git.Commands.Reset.args(%Git.Commands.Reset{mode: :soft, ref: "HEAD~1"})
    ["reset", "--soft", "HEAD~1"]

    iex> Git.Commands.Reset.args(%Git.Commands.Reset{mode: :hard})
    ["reset", "--hard", "HEAD"]

# `parse_output`

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

Parses the output of `git reset`.

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*
