Bird
0
0

Which of the following is the correct syntax to start an interactive rebase for the last 5 commits?

easy📝 Syntax Q3 of 15
Git - Rebasing
Which of the following is the correct syntax to start 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 N commits before HEAD.
  2. Step 2: Identify the valid option

    Only git rebase -i HEAD~5 correctly specifies the last 5 commits.
  3. Final Answer:

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

    HEAD~N is correct syntax for last N commits [OK]
Quick Trick: Use HEAD~N to specify last N commits in rebase [OK]
Common Mistakes:
  • Using caret (^) incorrectly
  • Adding extra symbols after ~
  • Confusing HEAD~ with HEAD^

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes