Bird
0
0

Given the following commands run in sequence:

medium📝 Command Output Q13 of 15
Git - Rebasing
Given the following commands run in sequence:
git checkout feature
git rebase main

What happens to the commits on feature branch?
AThey are replayed on top of the latest commit on <code>main</code>
BThey are deleted and replaced by <code>main</code> commits
CThey remain unchanged and <code>main</code> is merged
DThey are copied to a new branch named <code>main</code>
Step-by-Step Solution
Solution:
  1. Step 1: Understand what 'git rebase main' does on feature branch

    It takes commits from feature and replays them on top of main's latest commit.
  2. Step 2: Clarify what happens to commits

    Commits are not deleted but moved to appear after main's commits, creating a linear history.
  3. Final Answer:

    They are replayed on top of the latest commit on main -> 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 commits get deleted
  • Confusing rebase with merge
  • Assuming new branches are created

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes