Complete the command to undo the last commit but keep changes staged.
git [1] --soft HEAD~1
The git reset --soft HEAD~1 command moves the branch pointer back by one commit but keeps the changes staged.
Complete the command to create a new commit that undoes changes from a specific commit.
git [1] <commit-hash>The git revert command creates a new commit that reverses the changes made by the specified commit.
Fix the error in the command to undo the last commit and discard changes in working directory.
git [1] --hard HEAD~1
The git reset --hard HEAD~1 command moves the branch pointer back and discards all changes in the working directory.
Fill both blanks to create a new commit that undoes the last commit and pushes it to remote.
git [1] HEAD~1 && git [2] origin main
First, git revert HEAD~1 creates a new commit undoing the last commit. Then, git push origin main sends the changes to the remote repository.
Fill both blanks to reset the branch to the previous commit and force push to remote.
git [1] --hard HEAD~1 && git [2] origin main --force
git reset --hard HEAD~1 moves the branch pointer back one commit and discards changes. Then git push origin main --force updates the remote branch forcibly.