# `Git.CommitResult`
[🔗](https://github.com/joshrotenberg/git_wrapper_ex/blob/main/lib/git/commit_result.ex#L1)

Represents the parsed result of a `git commit` command.

Contains the branch name, short commit hash, commit subject, and change
statistics (files changed, insertions, deletions).

# `t`

```elixir
@type t() :: %Git.CommitResult{
  branch: String.t(),
  deletions: non_neg_integer(),
  files_changed: non_neg_integer(),
  hash: String.t(),
  insertions: non_neg_integer(),
  subject: String.t()
}
```

# `parse`

```elixir
@spec parse(String.t()) :: t()
```

Parses the output of `git commit` into a `Git.CommitResult` struct.

The expected format is:

    [branch hash] subject
     N file(s) changed, N insertion(s)(+), N deletion(s)(-)

Also handles root commits:

    [branch (root-commit) hash] subject

## Examples

    iex> output = "[main abc1234] the commit message\n 1 file changed, 5 insertions(+), 2 deletions(-)\n"
    iex> result = Git.CommitResult.parse(output)
    iex> result.branch
    "main"
    iex> result.hash
    "abc1234"
    iex> result.subject
    "the commit message"

---

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