THE GITHTML FIELD GUIDE

Resolve “unmerged files” before continuing Git

“Unmerged files” means the index still contains unresolved conflict entries. Run git status to identify the operation, inspect each conflicted path, edit the desired final content, and stage the resolved files. Continue using the command for that operation only after checking the result. Removing conflict markers alone does not prove the resolution is correct.

Find the operation and the competing changes

A conflict can arise during merge, rebase, cherry-pick, revert, or stash application. The appropriate next command depends on which operation is active, so begin with status rather than guessing. Inspect the conflict list and the surrounding code. The two sides may each be internally valid while requiring a new combined solution.

Text markers are only one presentation of conflicts. Rename, deletion, and binary conflicts may need decisions that cannot be solved by deleting marker lines. For a modify/delete conflict, decide whether the file should exist and why. Preserve the original evidence or a separate copy if you need another contributor’s judgment before resolving.

Resolve a focused path and inspect the index

The example commands list unresolved paths and inspect one file. After editing the intended result, stage only that resolved path. The staged diff should reflect the actual resolution, not unrelated work. If a file should be removed, use the appropriate deliberate removal rather than inventing empty content to satisfy the index.

  1. Confirm the result preserves the necessary behavior from both changes, or document why one side is intentionally superseded.
  2. Use the active operation’s continue command after every conflict is resolved; stash application does not have a generic stash --continue step.
shell
git status
git diff --name-only --diff-filter=U
git diff -- path/to/file
git add -- path/to/file
git diff --staged

Validate beyond the conflict markers

Search the resolved files for leftover markers, but also run relevant tests and inspect interfaces touched by both branches. A mechanically clean resolution can still call a removed function or duplicate a side effect. If the intended behavior is unclear, stop for the responsible maintainer instead of selecting one side to make Git proceed. Record the reasoning in the resulting commit or review discussion so future readers can understand why the integration differs from either original patch.

Binary conflicts require a tool or owner who can inspect the actual format. Choosing a file solely because it is labeled ours or theirs is not a reliable resolution of the product-level disagreement.

  1. For a modify/delete conflict, inspect why the deleting side removed the file before restoring it. A replacement module may already provide the behavior. If you retain the old file without reconnecting callers or tests, the resolution can look complete while leaving the intended fix unused.
  2. After staging a resolution, edit that file only with awareness that new edits are unstaged again. Compare both the staged patch and remaining working diff before continuing. Otherwise, the recorded resolution may omit the final correction that you can still see in the editor.

Sources and further reading

AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.

All fixing git problems guides →

Read as MarkdownAll guides

Resolve “unmerged files” before continuing Git · gitHtml