# `Exgit.Object.Commit`
[🔗](https://github.com/ivarvong/exgit/blob/v0.1.0/lib/exgit/object/commit.ex#L1)

A git commit object.

Commits are represented as a message plus an **ordered list of headers**.
Preserving both the order and the verbatim content of headers is required
for SHA stability: two commits with the same logical content but different
header orderings are distinct git objects with distinct SHAs. This matters
especially for signed commits — tampering with the header order would
invalidate the `gpgsig` block.

Convenience accessors (`tree/1`, `parents/1`, `author/1`, `committer/1`,
`gpgsig/1`) extract well-known headers. Arbitrary headers (e.g. `encoding`,
`mergetag`, `HG:rename`) are preserved in the `:headers` list but have no
dedicated accessor.

# `header`

```elixir
@type header() :: {name :: String.t(), value :: String.t()}
```

# `t`

```elixir
@type t() :: %Exgit.Object.Commit{headers: [header()], message: String.t()}
```

# `author`

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

# `committer`

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

# `decode`

```elixir
@spec decode(binary()) :: {:ok, t()} | {:error, term()}
```

# `encode`

```elixir
@spec encode(t()) :: iolist()
```

# `gpgsig`

```elixir
@spec gpgsig(t()) :: String.t() | nil
```

# `new`

```elixir
@spec new(keyword()) :: t()
```

# `parents`

```elixir
@spec parents(t()) :: [binary()]
```

# `sha`

```elixir
@spec sha(t()) :: Exgit.Object.sha()
```

# `sha_hex`

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

# `tree`

```elixir
@spec tree(t()) :: binary()
```

---

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