Bird
0
0

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

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

    Interactive rebase uses git rebase -i <commit> where commit is a reference point.
  2. Step 2: Understand HEAD~3 usage

    HEAD~3 means 3 commits before HEAD, so rebasing last 3 commits interactively is git rebase -i HEAD~3.
  3. Final Answer:

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

    Interactive rebase last 3 commits = git rebase -i HEAD~3 [OK]
Quick Trick: Use HEAD~N to specify last N commits for rebase [OK]
Common Mistakes:
  • Using number alone without HEAD~
  • Wrong flag like --interactive spelled out
  • Incorrect order of arguments

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes