What is the primary distinction between git merge and git rebase?

Prepare for the TJR Bootcamp Test with quizzes and flashcards. Each question includes hints and explanations to boost your readiness for the exam!

Multiple Choice

What is the primary distinction between git merge and git rebase?

Explanation:
The main distinction is how history is handled when integrating changes. Merging brings two lines of history together and creates a merge commit that has two parents, preserving every commit from both branches. Rebasing takes the commits from your feature branch and replays them on top of the current tip of the target branch, producing a linear history. Because the commits are replayed, they get new IDs, and the original feature commits aren’t preserved as-is. So, merging keeps the original history with a merge point, while rebasing rewrites history to a straight line, altering commit IDs.

The main distinction is how history is handled when integrating changes. Merging brings two lines of history together and creates a merge commit that has two parents, preserving every commit from both branches. Rebasing takes the commits from your feature branch and replays them on top of the current tip of the target branch, producing a linear history. Because the commits are replayed, they get new IDs, and the original feature commits aren’t preserved as-is. So, merging keeps the original history with a merge point, while rebasing rewrites history to a straight line, altering commit IDs.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy