Bird
0
0

Which line correctly starts an interactive rebase for the last 5 commits?

easy📝 Syntax Q3 of 15
Git - Rebasing
Which line correctly starts an interactive rebase for the last 5 commits?
Agit rebase -i HEAD^^5
Bgit rebase -i HEAD^5
Cgit rebase -i HEAD~^5
Dgit rebase -i HEAD~5
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct syntax for interactive rebase

    The correct syntax uses HEAD~N to specify last N commits.
  2. Step 2: Identify correct option

    Only git rebase -i HEAD~5 is valid syntax to rebase last 5 commits.
  3. Final Answer:

    git rebase -i HEAD~5 -> Option D
  4. Quick Check:

    HEAD~N syntax is correct 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 count
  • Adding extra symbols like ^^ or ~^
  • Confusing HEAD~N with branch names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes