## TL;DR

The base branch moved and your branch no longer rebases cleanly. Fetch, rebase onto the new base, resolve the conflicts, and force-push the branch.

## Error

```text
This branch has conflicts that must be resolved  -  This pull request cannot be automatically merged.
```

## Steps

1. Fetch the latest base: `git fetch origin` then `git rebase origin/main` (use your base branch name). Expected: git stops at the conflicting commits.
2. Resolve each conflict: edit the files, `git add` them, `git rebase --continue`. Expected: the rebase completes.
3. Force-push the rebased branch: `git push --force-with-lease`. Expected: the PR updates and the conflict warning clears.
4. Confirm checks re-run on the new head SHA. Expected: the PR is mergeable again.

## When to use

- The PR page says it cannot be automatically merged due to conflicts.
- The repo uses rebase merging or requires a linear history.

## When not to use

- The team allows merge commits  -  then 'Update branch' with a merge commit is simpler.
- The conflict is on files you do not own; coordinate with the other author first.

## Tool compatibility

- GitHub / GitLab / any git host.
- Git 2.x.

## Variant phrasings

### Conflicts only in generated files

Regenerate the files on top of the new base instead of hand-resolving.

### Rebase conflicts on every PR

Rebase more often, or ask the team to enable merge-queue which handles it automatically.

## Why it happens

The base branch advanced with changes touching the same lines as your branch. Git cannot decide which version wins, so automatic merging is blocked until a human resolves the overlap.

## Edge cases

- `--force-with-lease` is safer than `--force`: it aborts if someone else pushed meanwhile.
- Rebasing rewrites commit SHAs  -  warn collaborators on a shared branch before force-pushing.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_LonD68538YtIv5kD-6vgTA
