Bird
0
0

You have a feature branch with 3 commits diverged from main. After running git rebase main, what will the commit history look like?

medium📝 Command Output Q13 of 15
Git - Rebasing
You have a feature branch with 3 commits diverged from main. After running git rebase main, what will the commit history look like?
AThe 3 commits will be replayed on top of the latest <code>main</code> commits
BThe 3 commits will be merged into a single commit on <code>main</code>
CThe 3 commits will be deleted and replaced by <code>main</code> commits
DThe 3 commits will remain unchanged and <code>main</code> will be merged
Step-by-Step Solution
Solution:
  1. Step 1: Understand rebase effect on commits

    Rebase takes your commits and re-applies them on top of the target branch, here main.
  2. Step 2: Compare with merge behavior

    Merge combines histories with a merge commit; rebase rewrites history to appear linear.
  3. Final Answer:

    The 3 commits will be replayed on top of the latest main commits -> Option A
  4. Quick Check:

    Rebase = replay commits on new base [OK]
Quick Trick: Rebase replays commits on top of target branch [OK]
Common Mistakes:
  • Thinking rebase merges commits
  • Assuming commits are deleted
  • Confusing merge and rebase results

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes