Question: What does the following command do to the git repository?

  1. It deletes all previous commits and reset the repository history back to its initial state.
  2. It resets the working branch to the first commit.
  3. It keeps the HEAD at the current commit, but clears all previous commits.
  4. It sets HEAD to the previous commit and leaves changes from the undone commit in the stage/index.

Answer: The correct answer of the above question is Option D:It sets HEAD to the previous commit and leaves changes from the undone commit in the stage/index.