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

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

Supports pulling from a remote with options for rebase, fast-forward,
autostash, squash, depth, and more.

# `t`

```elixir
@type t() :: %Git.Commands.Pull{
  autostash: boolean(),
  branch: String.t() | nil,
  depth: pos_integer() | nil,
  dry_run: boolean(),
  ff_only: boolean(),
  no_autostash: boolean(),
  no_commit: boolean(),
  no_ff: boolean(),
  no_tags: boolean(),
  prune: boolean(),
  quiet: boolean(),
  rebase: boolean() | String.t(),
  remote: String.t() | nil,
  squash: boolean(),
  tags: boolean(),
  verbose: boolean()
}
```

# `args`

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

Returns the argument list for `git pull`.

Builds the argument list from the struct fields. Boolean flags are appended
when set to `true`. The `rebase` field may be `true` (for `--rebase`) or a
string such as `"interactive"` or `"merges"` (for `--rebase=<value>`). The
`remote` and `branch` positional arguments are appended at the end when
present.

## Examples

    iex> Git.Commands.Pull.args(%Git.Commands.Pull{})
    ["pull"]

    iex> Git.Commands.Pull.args(%Git.Commands.Pull{remote: "origin", branch: "main"})
    ["pull", "origin", "main"]

    iex> Git.Commands.Pull.args(%Git.Commands.Pull{rebase: true})
    ["pull", "--rebase"]

    iex> Git.Commands.Pull.args(%Git.Commands.Pull{rebase: "merges"})
    ["pull", "--rebase=merges"]

    iex> Git.Commands.Pull.args(%Git.Commands.Pull{ff_only: true, prune: true})
    ["pull", "--ff-only", "--prune"]

# `parse_output`

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

Parses the output of `git pull`.

On success (exit code 0), parses the output into a `Git.PullResult`
struct. On failure, returns `{:error, {stdout, exit_code}}`.

---

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