A walkthrough of the Resolve Merge Conflicts tutorial: why merging Alice's change collides with yours, how to read the conflict markers, and how to finish the merge.
This scenario puts you in a very common team situation: you and a teammate changed the same line, and Git needs your help to combine the two. You will pull your teammate's work, merge it into your branch, resolve the clash by hand, and complete the merge.
The situation
You are on the feature/update-subtitle branch, where you rewrote the hero subtitle on index.html. Meanwhile your teammate Alice pushed her own edit to that same subtitle line on main.
Two different edits to the same line, on two branches. Git can fast-forward or auto-merge changes that touch different places, but when both sides change the same line it cannot guess which one wins. That is a merge conflict, and only you can decide the outcome.
A conflict is not an error you did something wrong. It is Git pausing to let a human choose, because both edits are equally valid on their own.
Working through it, step by step
Bring main up to date
git checkout main
git pull
Switching to main and pulling brings in Alice's subtitle change from the remote, so your local main now has her work.
Merge main into your feature branch
git checkout feature/update-subtitle
git merge main
Git tries to combine Alice's subtitle line with yours, fails on that one line, and reports a conflict in index.html. The merge pauses here.
Open the file and read the markers
The conflicted region looks like this:
<<<<<<< HEAD
your version of the subtitle
=======
Alice's version of the subtitle
>>>>>>> main
HEAD is your branch; the part after ======= is the incoming change from main.
Resolve, then finish the merge
git add index.html
git commit
Edit index.html so it contains the single final subtitle you want, and delete the <<<<<<<, =======, and >>>>>>> lines. Staging the file tells Git the conflict is settled, and the commit records the merge.
Reading conflict markers
The three markers always come in the same order:
<<<<<<< HEAD to ======= is your side.
======= to >>>>>>> is the incoming side.
- Resolving means leaving the content you want and removing all three marker lines.
git status during a conflict lists the files still needing resolution under "Unmerged paths". When that list is empty, you are ready to commit.
Do not leave any marker line in the file. A stray ======= will be committed as real content and break the page. Search the file for the markers before you stage it.
If you want to start over
If a resolution gets messy, you can abort the whole merge and return to the state before it began:
git merge --abort