nerdexam
Cisco

200-901 · Question #375

Which command reverses the last commit without changing the index file or the working tree position?

The correct answer is C. git reset --soft HEAD^. The command git reset --soft HEAD^ will reverse the last commit without changing the index file or the working tree position. It leaves the changes from the undone commit staged (indexed), allowing you to make further modifications before committing.

Software Development and Design

Question

Which command reverses the last commit without changing the index file or the working tree position?

Options

  • Agit revert HEAD
  • Bgit reset --hard HEAD~3
  • Cgit reset --soft HEAD^
  • Dgit revert

How the community answered

(19 responses)
  • A
    11% (2)
  • B
    5% (1)
  • C
    68% (13)
  • D
    16% (3)

Explanation

The command git reset --soft HEAD^ will reverse the last commit without changing the index file or the working tree position. It leaves the changes from the undone commit staged (indexed), allowing you to make further modifications before committing.

Topics

#Git commands#Version Control#git reset --soft#Commit management

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice