Bird
0
0

How does git rebase conceptually differ from git merge in handling commit history?

easy📝 Conceptual Q1 of 15
Git - Rebasing
How does git rebase conceptually differ from git merge in handling commit history?
A<code>git rebase</code> only works on remote branches, whereas <code>git merge</code> works on local branches.
B<code>git merge</code> deletes the source branch after merging, but <code>git rebase</code> keeps both branches intact.
C<code>git rebase</code> rewrites commit history to create a linear sequence, while <code>git merge</code> preserves all branch histories by creating a merge commit.
D<code>git merge</code> flattens all commits into one, while <code>git rebase</code> creates multiple merge commits.
Step-by-Step Solution
Solution:
  1. Step 1: Understand git merge

    It combines histories by creating a new merge commit, preserving the original branch structure.
  2. Step 2: Understand git rebase

    It moves the entire branch to start from a new base, rewriting commit history to appear linear.
  3. Final Answer:

    git rebase rewrites commit history to create a linear sequence, while git merge preserves all branch histories by creating a merge commit. correctly describes the conceptual difference.
  4. Quick Check:

    Rebase rewrites history; merge preserves it. [OK]
Quick Trick: Rebase rewrites history; merge preserves it [OK]
Common Mistakes:
  • Thinking merge deletes branches
  • Assuming rebase only works on remote branches
  • Believing merge flattens commits

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes