What does git reset --soft do?

What does git reset --soft do?

a) Moves the HEAD pointer to a specific commit but keeps changes in the working directory
b) Deletes uncommitted changes
c) Deletes the commit history
d) Stashes changes

Answer:

a) Moves the HEAD pointer to a specific commit but keeps changes in the working directory

Explanation:

The git reset --soft command moves the HEAD pointer to a specific commit but leaves changes in the index (staging area) and working directory untouched. This allows you to re-commit changes with a new commit message or make further modifications.

It’s useful when you want to amend a commit without losing any changes in your working directory or staging area.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top