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

Parsed representation of the installed git version.

Holds the numeric `major`, `minor`, and `patch` components along with the
full `raw` version line as reported by `git --version`.

# `t`

```elixir
@type t() :: %Git.Version{
  major: non_neg_integer(),
  minor: non_neg_integer(),
  patch: non_neg_integer(),
  raw: String.t()
}
```

# `parse`

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

Parses the output of `git --version` into a `Git.Version` struct.

The version number is the third whitespace-delimited field. Its first three
dot-separated numeric components become `major`, `minor`, and `patch`; any
missing component defaults to `0`. The full trimmed line is kept in `raw`.

## Examples

    iex> Git.Version.parse("git version 2.50.1 (Apple Git-155)\n")
    %Git.Version{major: 2, minor: 50, patch: 1, raw: "git version 2.50.1 (Apple Git-155)"}

    iex> Git.Version.parse("git version 2.42.0.windows.2")
    %Git.Version{major: 2, minor: 42, patch: 0, raw: "git version 2.42.0.windows.2"}

---

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