Merge Commit

When both branches have moved on since they split, neither is simply ahead of the other. There is no pointer to slide.

So git makes a new commit with two parents — one for each side. That merge commit is the point where the two histories rejoin, and it is the only kind of commit with more than one parent.

The order matters: the first parent is the branch you were on, the second is the one you merged in.

Exercises

  1. Exercise 1. main and feature have each moved on by one commit since they split. Merge feature into main.
  2. Exercise 2. feature has two commits to main's one. Merge it in — the merge commit joins the two tips no matter how long each side is.