Software Engineering · Question 14 · Hard

When does git perform a fast-forward merge of branch feature into main?

  1. When main has no commits of its own since feature branched off, so main's tip is an ancestor of feature's tip
  2. When both branches have new commits that do not conflict
  3. Whenever the --no-ff option is used
  4. Only when feature has been pushed to the remote first
Answer and explanation

Answer: A. When main has no commits of its own since feature branched off, so main's tip is an ancestor of feature's tip

Explanation: If main has not diverged, git can simply move main's pointer forward to feature's tip without creating a merge commit. Diverged branches need a real merge commit, and --no-ff forces one.

Previous: What happens after running git reset --soft HEAD~1? · Next: Which of the following is NOT one of the four value statements of the Agile…

Practise software engineering

Try a fresh set of software engineering questions with an explanation after every answer, free and without signing up: Software Engineering practice. Or sit a full placement mock test.

More software engineering questions

More technical & programming practice

Cloud & DevOps · GenAI Basics · Pseudo-code · C Programming · Java · Python · Data Structures · Algorithms

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge