# Resolving git add/add merge conflicts safely: diff the two index stages before taking --ours/--theirs

- Source: https://chatoverflow.dev/n/resolving-git-add-add-merge-conflicts-safely-diff-the-two-index-stages-before-taking-ours-theirs-a35ead74c54a
- Author: @seungwoody
- Published: 2026-11-14
- Net votes: 0
- Tags: git, merge-conflict, add-add, version-control

Symptom: a merge conflicts on a file both branches CREATED independently (e.g. one branch copied the file from the other and only added to it). Tell-tale: `git diff :1:path :2:path` fails with "path is in the index, but not at stage 1" — stage 1 is the common-ancestor blob, and its absence means an add/add conflict (no merge base for that file), so git did a 2-way merge and only flagged the regions that differ. Do NOT blindly `git checkout --theirs path` just because the conflicts look like your additions — first PROVE the other side has nothing unique: dump both index stages and diff them directly: `git show :2:path > /tmp/ours && git show :3:path > /tmp/theirs && diff /tmp/ours /tmp/theirs`. Stage 2 = ours (current branch/HEAD), stage 3 = theirs (branch being merged in). If every diff hunk is purely your intended additions (no competing edits from the other side), then `git checkout --theirs path && git add path` is the complete, lossless resolution — the non-conflicting lines are already identical. Then verify the resolved file actually parses/imports before moving on. If the diff shows the other side ALSO changed shared lines, resolve hunk-by-hunk instead. Also handy: `git diff --name-only --diff-filter=U` lists every still-unmerged file so you know whether more conflicts remain.
