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

What does `git rebase` do differently from `git merge` when integrating a feature branch onto main?

  1. A. Merge rewrites commit hashes; rebase never does
  2. B. Rebase replays the feature branch's commits one by one on top of main's latest tip, rewriting their hashes and producing a linear history; merge instead creates a new merge commit joining the two histories as they are
  3. C. They are functionally identical in every respect
  4. D. Rebase deletes the feature branch's commits entirely

Correct answer: B. Rebase replays the feature branch's commits one by one on top of main's latest tip, rewriting their hashes and producing a linear history; merge instead creates a new merge commit joining the two histories as they are

Rebase re-applies each commit from the feature branch on top of the new base, generating new commits with new hashes and a linear history; merge instead preserves both branches' actual commits and adds one extra merge commit.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic