Lesson 2 · Unit 02
Merging
Fast-forwards, merge commits and conflicts
What you practise
- Fast-forward vs a merge commit with two parents, the merge base, how conflicts arise and how to read the markers
Try a question from this lesson
Pick one
main has no commits of its own since feature split off. What is the least git must do so that main includes c and d?
a --- b main
\
c --- d featureCorrect answer
Move the main pointer to d
Why
d already contains everything in b, because b is its ancestor. So git slides the main pointer forward to d. That is a fast-forward merge: no new commit, nothing to combine.
The idea
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
When both sides moved
If both branches have new commits there is nothing to slide to. Git combines the two snapshots and records the result in a merge commit: a commit with two parents.
To combine, it finds the merge base, the newest commit both branches share, and applies what each side changed since then.
a --- b --- m main
\ /
c ------+ feature
m has two parents: b and c11 more exercises in the app
- 4× type the answer
- 2× multiple choice
- 1× fill the blanks
- 2× true or false
- 1× order the lines
- 1× match the pairs
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.