CS FundamentalsHardProduct-company placement · Git interview

During git rebase -i, what is the difference between marking a commit 'squash' and marking it 'fixup'?

  1. A. squash deletes the commit; fixup keeps it
  2. B. They are identical
  3. C. fixup moves the commit to the end of the list
  4. D. Both meld the commit into the previous one; squash lets you combine and edit both commit messages, while fixup discards the fixup commit's message

Correct answer: D. Both meld the commit into the previous one; squash lets you combine and edit both commit messages, while fixup discards the fixup commit's message

fixup is for 'oops' commits whose messages add nothing; squash is used when both messages contain useful information. git commit --fixup plus rebase --autosquash automates the ordering.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic