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

Merge conflict detection and resolution helpers that compose `Git.status/1`
and `Git.merge/2`.

All functions accept an optional keyword list. Use `:config` to specify the
repository via a `Git.Config` struct; when omitted a default config is built
from the environment.

# `abort_merge`

```elixir
@spec abort_merge(keyword()) :: {:ok, :done} | {:error, term()}
```

Aborts an in-progress conflicted merge.

Delegates to `Git.merge(:abort)`.

## Options

  * `:config` - a `Git.Config` struct

## Examples

    {:ok, :done} = Git.Conflicts.abort_merge()

# `detect`

```elixir
@spec detect(keyword()) :: {:ok, boolean()} | {:error, term()}
```

Checks whether the repository is in a conflicted state.

Uses `Git.status/1` and inspects entries for unmerged status codes.

Returns `{:ok, true}` when conflicts exist, `{:ok, false}` otherwise.

## Options

  * `:config` - a `Git.Config` struct

## Examples

    {:ok, false} = Git.Conflicts.detect()

# `files`

```elixir
@spec files(keyword()) :: {:ok, [String.t()]} | {:error, term()}
```

Lists file paths that have merge conflicts.

Uses `Git.status/1` and filters for entries with unmerged status codes.

Returns `{:ok, [String.t()]}`.

## Options

  * `:config` - a `Git.Config` struct

## Examples

    {:ok, files} = Git.Conflicts.files()

# `resolved?`

```elixir
@spec resolved?(keyword()) :: {:ok, boolean()} | {:error, term()}
```

Checks whether all conflicts have been resolved.

This is the inverse of `detect/1` -- returns `{:ok, true}` when no unmerged
files exist.

## Options

  * `:config` - a `Git.Config` struct

## Examples

    {:ok, true} = Git.Conflicts.resolved?()

---

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