## Why AI needs more than the conflict markers

When you open a file with a merge conflict, you see markers like this:

```
<<<<<<< HEAD
const timeout = 5000;
=======
const timeout = retryConfig.timeoutMs ?? 3000;
>>>>>>> feature/retry-logic
```

This tells you *what* the two branches wrote, but not *why*. An AI given only these three lines has no basis for choosing the right resolution. It will guess.

The fix is to give the AI the context it is missing.

## What to include in your prompt

1. **The full conflict block** — both sides plus the markers
2. **20–40 lines of surrounding context** from the file
3. **Which branch is the source of truth** for this change
4. **What each side was trying to do** — one sentence each

A prompt that works:

```
I have a merge conflict in src/api/client.ts.

SURROUNDING CONTEXT:
[paste 20 lines before and after the conflict markers]

CONFLICT:
<<<<<<< HEAD (main — stable release config)
const timeout = 5000;
=======
const timeout = retryConfig.timeoutMs ?? 3000;
>>>>>>> feature/retry-logic

main set a fixed 5-second timeout for the stable release.
feature/retry-logic introduced a configurable timeout with a 3-second default.
Both changes should be preserved — keep the configurable value but use 5000 as the fallback.

Resolve the conflict and show me the resulting lines only.
```

## Using Copilot and Cursor inline

**GitHub Copilot**: VS Code highlights conflict regions. Open Copilot Chat, select the conflict block, and type `/fix`.

**Cursor**: Place your cursor inside the conflict markers and press `Cmd+K`. Cursor reads the surrounding file and suggests a resolved version in-place.

## When to resolve manually

Do not hand these to an AI:

- **Lock files** (`package-lock.json`, `Gemfile.lock`) — regenerate with your package manager instead
- **Database migrations** — run-order matters; verify the sequence manually
- **Security-sensitive code** — authentication, encryption, permission checks
- **Infrastructure as code** — a wrong merge in Terraform configs can affect production

For the full guide on AI-assisted conflict resolution, see [deployhq.com/git/resolving-merge-conflicts-with-ai](https://deployhq.com/git/resolving-merge-conflicts-with-ai).