CS FundamentalsVery hardGATE CS · TCS NQT Prime · Product Company SDE

What is the key difference between `git merge --no-ff` and a fast-forward merge?

  1. A. A fast-forward merge always creates a merge commit; --no-ff never does
  2. B. --no-ff always creates an explicit merge commit recording that a merge happened, even when a fast-forward would otherwise be possible; a fast-forward merge just moves the branch pointer forward with no extra commit
  3. C. --no-ff deletes the feature branch automatically
  4. D. They produce identical history in every case

Correct answer: B. --no-ff always creates an explicit merge commit recording that a merge happened, even when a fast-forward would otherwise be possible; a fast-forward merge just moves the branch pointer forward with no extra commit

When the current branch's history is a strict ancestor of the branch being merged, Git can simply fast-forward the pointer with no merge commit; --no-ff forces a merge commit to be created anyway, preserving a visible record of the feature branch's existence.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic