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

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

Supports reverting one or more commits, aborting an in-progress revert,
continuing after conflict resolution, and skipping a commit during a
multi-commit revert.

# `t`

```elixir
@type t() :: %Git.Commands.Revert{
  abort: boolean(),
  commits: [String.t()],
  continue_revert: boolean(),
  mainline: non_neg_integer() | nil,
  no_commit: boolean(),
  no_edit: boolean(),
  signoff: boolean(),
  skip: boolean(),
  strategy: String.t() | nil,
  strategy_option: String.t() | nil
}
```

# `args`

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

Returns the argument list for `git revert`.

- When `:abort` is `true`, builds `git revert --abort`.
- When `:continue_revert` is `true`, builds `git revert --continue`.
- When `:skip` is `true`, builds `git revert --skip`.
- Otherwise builds `git revert [options] <commits>`.

## Examples

    iex> Git.Commands.Revert.args(%Git.Commands.Revert{commits: ["HEAD"]})
    ["revert", "HEAD"]

    iex> Git.Commands.Revert.args(%Git.Commands.Revert{commits: ["HEAD"], no_commit: true})
    ["revert", "--no-commit", "HEAD"]

    iex> Git.Commands.Revert.args(%Git.Commands.Revert{abort: true})
    ["revert", "--abort"]

    iex> Git.Commands.Revert.args(%Git.Commands.Revert{continue_revert: true})
    ["revert", "--continue"]

    iex> Git.Commands.Revert.args(%Git.Commands.Revert{skip: true})
    ["revert", "--skip"]

# `parse_output`

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

Parses the output of `git revert`.

For `--abort`, `--continue`, and `--skip` operations (exit code 0), returns
`{:ok, :done}`. For normal revert operations (exit code 0), parses into a
`Git.RevertResult` struct. On failure, returns
`{:error, {stdout, exit_code}}`.

---

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