QuestenaPractice that shows what to review next
Question 5

With default merge settings, when does `git merge` perform a fast-forward instead of creating a merge commit?

  1. When the current tip is an ancestor of the merged branch, so Git only moves the pointer forwardCorrect answer
  2. When both branches have new commits but none of the files they changed overlap with each other
  3. Whenever the merge completes without conflicts
  4. Only when the `--squash` option is given

Explanation

A fast-forward happens only when there is no divergence: the merged branch already contains everything on the current branch, so Git can simply move the pointer forward without creating any new commit. The tempting distractor is 'whenever there are no conflicts' — when both branches have new commits, Git performs a three-way merge and creates a merge commit even if it is entirely conflict-free. With --no-ff or merge.ff=false, Git creates a merge commit even in this situation.

Continue with this test

Start practice
Question 5: With default merge settings, when does `git merge` perform… · Git Fundamentals · Questena