Read both versions, choose the final content, then finish the merge without losing your work.
Two branches edited the same line differently. Git knows both versions, but not which wording you want. It keeps the merge open and asks you to choose. Do not delete the whole file or force the merge.
hello
<<<<<<< HEAD
formal welcome
=======
friendly welcome
>>>>>>> feature/wordingThe current branch's version, main in this example.
The equals line separates the alternatives. It is not content to keep.
The version from the branch being merged. You can keep either version, combine them, or write something else.
This text exercise checks for marker lines, not whether your chosen wording is correct.
Choose the wording you want and remove the marker lines.
Edit each conflicted file. Remove markers, read the resulting code or text, and test it. Staging marks the file as resolved; it does not judge your solution.
git status
# Edit greeting.txt and keep the intended final text.
git add greeting.txt
git status
git commit -m "Resolve greeting conflict"A clean status after the commit means Git has recorded the merge. Still run the project's tests and inspect the final files.
Recorded locally on Git 2.34.1. From the Chapter 11 repository, feature/wording committed friendly welcome; main committed formal welcome at the same line. The file was then edited to contain hello and friendly and formal welcome before staging.
$ git switch -c feature/wording
Switched to a new branch 'feature/wording'
$ git switch main
Switched to branch 'main'
$ git merge feature/wording
Auto-merging greeting.txt
CONFLICT (content): Merge conflict in greeting.txt
Automatic merge failed; fix conflicts and then commit the result.
$ cat greeting.txt
hello
<<<<<<< HEAD
formal welcome
=======
friendly welcome
>>>>>>> feature/wording
$ git status --short
UU greeting.txt
$ git add greeting.txt
$ git commit -m Resolve greeting conflict
[main 7fa9d99] Resolve greeting conflict
$ git status --short
git merge --abort attempts to return to the pre-merge state while the merge is still in progress. It can be unable to reconstruct earlier uncommitted work. This is why a clean starting tree matters.
This lesson uses a normal two-branch merge, not a rebase or cherry-pick. Those operations have their own continue and abort commands. Do not copy a recovery command from the wrong operation.
No. It tells Git to use the current file as the resolution. You still need to check meaning and tests.
No. The right result might combine both sides or replace them entirely.
Official git merge documentation · Git book: Basic Merge Conflicts