Video: Resolve merge and rebase conflicts
The video plays in YouTube’s player, in privacy-enhanced mode.
- 7 min video
- English narration · English and Arabic captions
- Watch on YouTube
Resolve the same competing headline in a merge and in a rebase, see why "ours" and "theirs" swap between them, save one deliberate combined result and finish each operation without losing either person's idea.
Read the full lesson
The article has every step and command from the video, the practice exercise and the questions.
Video transcript
The narration of the video, cue by cue.
- A conflict is not an error. It is a question only you can answer.
- Two people changed the same line of the same file.
- Sara wrote one heading. Omar wrote another. Both started from the same page.
- Git cannot guess which line wins, so it stops and asks you.
- First, build Sara's and Omar's branches, and two identical copies.
- In the first copy we merge. In the second, we rebase.
- Open the merge copy, on Sara's branch.
- Right-click Omar's branch and choose its Merge command.
- The dialog already warns: this will stop with a conflict in one file.
- Choose Always a merge commit, then Merge once. It stops, as expected.
- The banner shows one conflict. Continue is not available yet.
- Choose Resolve, and open index.html.
- Two sides: Sara's branch is current, Omar's is incoming.
- Show Base reveals the common ancestor, the page before either change.
- Now Edit Output. Replace the heading with one deliberate line.
- Save and Mark Resolved. Only now does Git treat the file as resolved.
- Back on the banner, choose Continue. The merge finishes.
- The new commit has two parents, and the combined heading.
- Now the rebase copy, also on Sara's branch.
- Right-click Omar's branch, and rebase Sara's branch onto it.
- Leave the options off, and rebase once. It stops with a conflict.
- Look at the labels. Now Omar's branch is the one we rebase onto.
- Sara's commit is the one being replayed. The roles have swapped.
- Same resolution: Edit Output, then Save and Mark Resolved, then Continue.
- Sara's commit is recreated on top of Omar's, with the same heading.
- In the terminal, list the unmerged entries of a stopped merge.
- Stage two is ours: Sara's heading. Stage three is theirs: Omar's.
- In a stopped rebase, stages two and three are the other way round.
- After the fix, nothing is unmerged, and the status is empty.
- The merge copy's tip has two parents; the rebase copy's tip has one.
- Change the input: delete the markers and save, but do not mark resolved.
- Git still sees three stages, so Continue stays unavailable.
- Stuck? Abort puts the branch back where the operation began.
- GitTree saves a recovery snapshot first, so even an abort is safe.
- Never take all from one side before you read both versions.
- Practice: prove the stage roles in both copies, then finish both.
- Next, continue, skip or abort an operation that has stopped.