Um momento
0x50Lesson 6 of 6

Resolve conflicts and recover safely

Work through conflicting edits and choose an undo strategy that protects shared work.

12 min 5-question quiz
By the end of this lesson you can
  • Resolve a merge conflict and choose between revert, reset and rebase.

A conflict means Git cannot automatically combine overlapping changes. Open each conflicted file, choose or edit the final content, remove conflict markers, then stage the resolution. For a merge, finish with a commit; for a rebase, continue replaying commits.

terminal · git
1<<<<<<< HEAD
2Current branch version
3=======
4Incoming branch version
5>>>>>>> feature/profile
6
7# edit the file, then stage it
8git add README.md
9git merge --continue
Output
<<<<<<<, ======= and >>>>>>> mark the competing changes
After editing and staging:
Merge made by the recursive strategy.

git reset moves the current branch and can discard changes depending on its mode. git rebase replays commits and rewrites their IDs. Use these on private work when appropriate; for public/shared commits, prefer git revert and coordinate before rewriting remote history.

Key takeaways

  • Resolve each conflict by editing the file into the intended final version.

  • Stage resolved files; then complete the merge or continue the rebase.

  • Use revert for shared history; reserve reset and rebase for deliberate history changes.

Lesson quiz

5 questions · pass with 4 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…

Gostou da aula? 😆👍
Apoie nosso trabalho com uma doação: