Stage 2 · Lesson 6 of 7
Resolving conflicts during a rebase
A happens when your and upstream changed the same lines, so cannot decide which version to keep. The stops and waits for you. git status lists the files involved.
In each one, the markers <<<<<<<, ======= and >>>>>>> surround the two versions. During a rebase the "ours" and "theirs" are swapped compared with a merge, which confuses everyone. So read the code, not the labels.
Edit the file into the correct combined version and delete the markers. Then git add the file and run git rebase --continue. Repeat for each commit that conflicts.
If you get lost, git rebase --abort puts everything back. Run the tests afterwards. Upstream may have renamed something you call, and code without markers can still be wrong.
A question to check yourself, an AI practice session and 2 cheat sheet entries come with the full roadmap. Unlock
Resources for this stage
Start with
- BookFreePro Git
Scott Chacon and Ben Straub
Chapters 3, 5 and 6: branching, contributing to a project, and GitHub forks