Bird
0
0

Which Git command starts an interactive rebase to squash commits?

easy📝 Syntax Q12 of 15
Git - Rebasing
Which Git command starts an interactive rebase to squash commits?
Agit commit --squash HEAD~3
Bgit merge -i HEAD~3
Cgit rebase -i HEAD~3
Dgit reset --soft HEAD~3
Step-by-Step Solution
Solution:
  1. Step 1: Identify the command for interactive rebase

    The command to start an interactive rebase is git rebase -i followed by the commit range.
  2. Step 2: Confirm the correct syntax

    git rebase -i HEAD~3 opens the last 3 commits for editing, allowing squashing.
  3. Final Answer:

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

    Interactive rebase = git rebase -i [OK]
Quick Trick: Use git rebase -i to start squashing commits [OK]
Common Mistakes:
  • Using git merge -i which does not exist
  • Trying git commit --squash which is invalid
  • Confusing reset with rebase for squashing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes