CS FundamentalsModerateWipro · Accenture pattern

A developer runs git reset --soft HEAD~1 on a branch. What happens?

  1. A. The last commit is removed and its changes are deleted from the working directory
  2. B. The last commit is kept, but a new commit undoing it is added
  3. C. The last commit is removed from the branch, and its changes stay staged in the index
  4. D. The changes are unstaged but kept in the working directory

Correct answer: C. The last commit is removed from the branch, and its changes stay staged in the index

--soft moves only the branch pointer; index and working tree are untouched, so the changes are ready to recommit. --mixed (default) would unstage them; --hard would discard them.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic