CS FundamentalsHardProduct-company MCQ pattern

On main you run git merge --squash feature and then git commit. Afterwards you try git branch -d feature. What happens?

  1. A. main gets a merge commit with two parents, and the branch is deleted
  2. B. main gets one ordinary (single-parent) commit, and git branch -d refuses because feature is not recorded as merged
  3. C. main gets all of feature's commits individually, and the branch is deleted
  4. D. main gets one ordinary commit, and git branch -d deletes the branch silently

Correct answer: B. main gets one ordinary (single-parent) commit, and git branch -d refuses because feature is not recorded as merged

--squash stages the combined changes but records no merge, so the new commit has one parent and feature's commits are not ancestors of main. git branch -d therefore says 'not fully merged'; git branch -D would force it.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic