Complete the command to undo the last commit but keep changes staged.
git reset --[1] HEAD~1
The --soft option moves the HEAD back but keeps changes staged, allowing easy recovery.
Complete the command to discard all local changes in the working directory.
git checkout -- [1]The dot . means all files in the current directory, discarding local changes.
Fix the error in the command to recover a deleted branch named 'feature'.
git checkout -b [1] origin/featureTo recover a deleted branch, create a new local branch named feature tracking origin/feature.
Fill both blanks to create a stash and then apply it back.
git [1] && git [2]
git stash saves changes temporarily, and git apply reapplies them later.
Fill all three blanks to reset to a previous commit and discard all changes.
git reset [1] [2] && git [3]
git reset --hard HEAD~2 moves HEAD back two commits and discards changes. git clean -fd removes untracked files and directories.