# The Agent Merged It. What Changed?

I ask an agent to merge `main` into my feature branch. A few minutes later it says, “Merged and pushed.” I used to work through each conflict myself, so I knew which changes I’d kept and why. When the agent does it, I want to be able to retrace those decisions.

With the latest code and a clear idea of what my branch is trying to do, even a model like `Sol 6.2-medium` can work through many routine conflicts. A short prompt can be enough to get it moving. A little Bash helps me review the result. If I know which Git command answers which question, I can run it myself or ask the agent to walk me through the output.

I start by finding the merge commit. `--first-parent` follows the history of my branch through merges, and `--merges` shows only merge commits.

```bash
git log --first-parent --merges --oneline -10 feature-branch
```

The log shows recent merge commits, with a short SHA at the start of each line. I pick the merge I want to review and copy its SHA. Here I’ll use `7e4a1c2`. In the commands below, `${merge}^1` refers to my feature branch just before the merge, and `${merge}^2` refers to the commit from `main` that went into it. Those two parents let me replay the merge even after both branches have moved on.

```bash
merge=7e4a1c2
git merge-tree --write-tree --name-only "${merge}^1" "${merge}^2"
```

`git merge-tree` computes the merge without changing my working tree or index. I use `--name-only` to get a short list of conflicted paths. The first line is the tree ID. The line I need for the review is the file path. An exit status of `1` here means the replay found a conflict.

```text
b81d2f04a7c93e165f0b2d48ce9a67310d54bf82
src/config/feature-flags.ts

Auto-merging src/config/feature-flags.ts
CONFLICT (content): Merge conflict in src/config/feature-flags.ts
```

Once I know where Git got stuck, I use `--remerge-diff` to see how the committed result differs from Git’s replay, including how the conflict markers and the lines around them were resolved.

```bash
git show --remerge-diff "$merge"
```

Then I compare the final file with each parent. The first diff tells me what changed on my branch. The second tells me what my branch carried into the result.

```bash
path=src/config/feature-flags.ts
git diff "${merge}^1" "$merge" -- "$path"
git diff "${merge}^2" "$merge" -- "$path"
```

I read `git diff A B` as “What would I have to change in `A` to get `B`?” Both commands put the completed merge on the right. The parent on the left tells me whose copy I’m starting from. `^1` is the branch I was on. `^2` is the branch I brought in.

The next time an agent says “Merged and pushed,” I’ll ask for the **merge SHA, the conflicted files, what it kept from each side, and which tests it ran**. The SHA gives me both starting points, so I can check the decisions that matter to my branch.

Photo by [**The Modern Coder**](https://www.youtube.com/@themoderncoder)
