Git & GitHub·Merge and rewrite

Merging and conflicts

Combine finished work and resolve the overlapping lines calmly.

Beginner 15 min read Lesson 10 of 480 Challenge included
What you will be able to do
  • Distinguish fast-forward and merge commits
  • Read conflict markers
  • Finish or abort a merge

A merge joins two histories. Git can combine most changes automatically; when both sides edit the same lines, you resolve the overlap by hand.

merge.shTerminal
git switch main
git pull
git merge feature/pricing
# resolve the marked files
git add pricing.md
git commit
git merge --abort
conflict.txtText
<<<<<<< HEAD
price = base * 1.15
=======
price = base * 1.25
>>>>>>> feature/pricing
MarkerMeaning
<<<<<<< HEADStart of your current branch version
=======Divide between the two versions
>>>>>>> branchEnd of the incoming version
Your turn

Finish a merge safely

Easy

After resolving pricing.md, which commands complete the merge?

BASH · starter
# your commands here
Check your understanding before moving on.
Knowledge checkQuestion 1

What happens in a fast-forward merge?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Next: Rebasing and history
Lesson 10 of 480 · 0% of course