Bird
0
0

Which of the following is the correct command to start an interactive rebase for the last 3 commits?

easy📝 Syntax Q12 of 15
Git - Rebasing
Which of the following is the correct command to start an interactive rebase for the last 3 commits?
Agit rebase -i HEAD~3
Bgit rebase -i HEAD^3
Cgit rebase -i HEAD~
Dgit rebase -i HEAD^^3
Step-by-Step Solution
Solution:
  1. Step 1: Recall the syntax for interactive rebase

    The correct syntax uses HEAD~N to specify the last N commits, so HEAD~3 means last 3 commits.
  2. Step 2: Check other options for syntax errors

    HEAD^3 and HEAD^^3 are invalid for this purpose; HEAD~ is incomplete.
  3. Final Answer:

    git rebase -i HEAD~3 -> Option A
  4. Quick Check:

    Use HEAD~N for last N commits [OK]
Quick Trick: Use HEAD~N to specify last N commits in rebase [OK]
Common Mistakes:
  • Using caret (^) incorrectly for commit range
  • Omitting the number after ~
  • Confusing HEAD~ with HEAD^

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes