Which command reverses the last commit without changing the index file or the working tree position?
The command git reset --soft HEAD^ reverses the last commit but keeps the changes staged in the index file (staging area) and working directory. Here's what the command does:
git reset --soft: Moves the HEAD pointer to the specified commit (in this case, the parent of the current commit, denoted by HEAD^) but leaves the changes from the reset commit in the staging area.
HEAD^: Refers to the parent commit of the current HEAD.
This command is useful when you want to uncommit the last commit but keep the changes for further modification or recommit them.
Cisco DevNet Associate Certification Guide