Complete the command to start an interactive rebase for the last 3 commits.
git rebase -i HEAD~[1]The command git rebase -i HEAD~3 opens an interactive rebase for the last 3 commits, allowing you to squash them.
Complete the command to squash the current commit into the previous one during interactive rebase.
In the editor, replace 'pick' with '[1]' for the commit to squash.
Replacing 'pick' with 'squash' combines the commit with the previous one and allows editing the commit message.
Fix the error in the command to abort an ongoing rebase.
git rebase --[1]The command git rebase --abort stops the rebase and returns to the original state.
Fill both blanks to create a new commit message during squash.
After squashing, edit the message and save with [1] then exit with [2].
In the editor, :wq writes (saves) and quits, and :x also saves and exits. Both are valid ways to save the commit message and exit.
Fill all three blanks to squash commits and push changes safely.
git rebase -i HEAD~[1] && git push origin [2] --[3]
Use HEAD~3 to rebase last 3 commits, push to branch main, and use --force-with-lease to safely force push after rewriting history.