Overview
- staging changes a line in 4.txt to one value.
- development changes the same line to another value.
- development then runs git merge staging.
Git cannot determine whether the staging value, the development value, or a combination should be kept. It stops the automatic merge and marks the file as conflicted.
The file then contains conflict markers that identify the competing sections. The developer must open the file and decide the final content.
The valid resolution may be:
- Keep the current branch's version.
- Keep the incoming branch's version.
- Combine parts of both.
- Replace both with a corrected result.
After editing, remove the conflict markers, save the file, stage the resolved result, and commit it:
git add .
git commit -m "Resolve merge conflict"
The resolution commit records the chosen final content.
Once the branches contain compatible resolved content, later merges can proceed without repeating the same conflict.