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

Represents the result of a `git checkout` branch operation.

Returned by `Git.checkout/1` when switching to or creating a branch.
For file restore operations, `{:ok, :done}` is returned instead.

# `t`

```elixir
@type t() :: %Git.Checkout{branch: String.t() | nil, created: boolean()}
```

# `parse`

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

Parses the output of `git checkout` for branch operations.

Handles the following output patterns:

  - `"Switched to a new branch 'name'"` — created and switched
  - `"Switched to branch 'name'"` — switched to existing branch
  - `"Already on 'name'"` — already on the requested branch

## Examples

    iex> Git.Checkout.parse("Switched to a new branch 'feat/new'\n")
    %Git.Checkout{branch: "feat/new", created: true}

    iex> Git.Checkout.parse("Switched to branch 'main'\n")
    %Git.Checkout{branch: "main", created: false}

    iex> Git.Checkout.parse("Already on 'main'\n")
    %Git.Checkout{branch: "main", created: false}

---

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