Git - RebasingWhich of the following is the correct command to start an interactive rebase for the last 3 commits?Agit rebase -i HEAD^^3Bgit rebase -i HEAD~3Cgit rebase -i HEAD~Dgit rebase -i HEAD^3Check Answer
Step-by-Step SolutionSolution:Step 1: Recall the syntax for interactive rebaseThe correct syntax uses HEAD~N to specify the last N commits, so HEAD~3 means last 3 commits.Step 2: Check the optionsHEAD^3 and HEAD^^3 are invalid for this purpose; HEAD~ alone is incomplete.Final Answer:git rebase -i HEAD~3 -> Option BQuick Check:HEAD~3 selects last 3 commits [OK]Quick Trick: Use HEAD~N to select last N commits for rebase [OK]Common Mistakes:Using HEAD^3 instead of HEAD~3Omitting the number after ~Using double carets ^^ incorrectly
Master "Rebasing" in Git9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Git Quizzes Cherry-Pick and Advanced Merging - Ours vs theirs in conflicts - Quiz 12easy Cherry-Pick and Advanced Merging - Merge strategies overview - Quiz 11easy Collaboration Workflows - Gitflow workflow - Quiz 14medium Collaboration Workflows - Code review in pull requests - Quiz 10hard Collaboration Workflows - Pull request process - Quiz 10hard Rebasing - Reordering commits - Quiz 5medium Remote Repositories - git push to upload commits - Quiz 2easy Stashing - Stashing specific files - Quiz 15hard Stashing - git stash pop to restore - Quiz 5medium Tagging - Pushing tags to remote - Quiz 12easy