Solution Reference: Challenge 7 -- Resolve a Merge Conflict
This shows what conflict markers look like and how to resolve them.
What conflict markers look like
When Git cannot automatically merge two changes to the same lines, it inserts markers:
<<<<<<< HEAD
Welcome to the Learning Room! This is the main branch version.
=======
Welcome to the Learning Room! This is my improved version with more detail.
>>>>>>> fix/welcome-update
The three sections
- Between
<<<<<<< HEADand=======: The version on the branch you are merging INTO (usually main) - Between
=======and>>>>>>>: The version on YOUR branch - The marker lines themselves: Must be deleted -- they are not content
Example resolution
Before (with conflict markers):
<<<<<<< HEAD
Welcome to the Learning Room! This is the main branch version.
=======
Welcome to the Learning Room! This is my improved version with more detail.
>>>>>>> fix/welcome-update
After (resolved):
Welcome to the Learning Room! This is my improved version with more detail.
Decision process
You chose one of three options:
- Keep yours: Delete the HEAD section and all markers, keep your changes
- Keep theirs: Delete your section and all markers, keep the HEAD version
- Combine both: Write new text that incorporates ideas from both versions, delete all markers
All three are valid. The choice depends on which version is better for the project.
On github.com
GitHub offers a conflict editor directly in the browser:
- Click "Resolve conflicts" on the PR page
- The editor highlights conflicting sections
- Edit the file to remove markers and keep the content you want
- Click "Mark as resolved" then "Commit merge"
In VS Code
VS Code highlights conflicts and offers clickable options above each conflict:
- "Accept Current Change" (HEAD version)
- "Accept Incoming Change" (your version)
- "Accept Both Changes" (keeps both, you edit after)
What matters
The learning objective is understanding that conflicts are normal and resolvable. If you removed all conflict markers and the file makes sense, you completed this challenge.
Authoritative Sources
Use these official references when you need the current source of truth for facts in this chapter.
Section-Level Source Map
Use this map to verify facts for each major section in this file.
- What conflict markers look like: GitHub Docs, home, GitHub Changelog
- Example resolution: GitHub Docs, home, GitHub Changelog
- On github.com: GitHub Docs, home, GitHub Changelog, About Git, GitHub flow, About pull requests
- In VS Code: GitHub Docs, home, GitHub Changelog
- What matters: GitHub Docs, home, GitHub Changelog