All fixes

Help, I got a merge conflict

Both branches changed the same lines and Git wants you to decide. Resolve it in four steps, or back out.

What Git says~/my-app
git merge feature/login
Auto-merging index.html
CONFLICT (content): Merge conflict in index.html
Automatic merge failed; fix conflicts and then commit the result.

The fix

  1. git status

    Lists the files with conflicts under “both modified”.

  2. Open each of those files. Between <<<<<<< and >>>>>>> you see both versions: keep what should stay and delete the three marker lines.

  3. git add index.html

    Marks the file as resolved. Repeat for every conflicted file.

  4. git commit --no-edit

    Completes the merge with Git's prepared message, without opening an editor.

index.html is an example. Replace it with your own.

What happens to your history
BeforeABFHEADmainfeature/login
AfterABFMHEADmainfeature/login

Why this works

Git merges whatever it can by itself. Only where both sides changed the same lines does it stop and write both versions into the file, between <<<<<<<, ======= and >>>>>>>. You choose what stays, git add tells Git the file is settled, and the commit completes the merge. Nothing is lost while you do this, and git merge --abort takes you back to the start at any point.