Software Engineering · Question 13 · Hard
What happens after running git reset --soft HEAD~1?
- The last commit is removed and its changes are discarded from the working directory
- The last commit is undone and its changes remain staged in the index
- The last commit is undone and its changes stay in the working directory but are unstaged
- A new commit is created that reverses the last commit
Answer and explanation
Answer: B. The last commit is undone and its changes remain staged in the index
Explanation: --soft moves the branch pointer back one commit but leaves the index and working tree alone, so the changes stay staged. --mixed (the default) unstages them, --hard discards them, and git revert creates an inverse commit.
Previous: A function accepts an integer age that is valid from 18 to 60. Using… · Next: When does git perform a fast-forward merge of branch feature into main?
Practise software engineering
Try a fresh set of software engineering questions with an explanation after every answer, free and without signing up: Software Engineering practice. Or sit a full placement mock test.
More software engineering questions
- What is the difference between git fetch and git pull?
- Good software design aims for which combination of cohesion and coupling?
- A function accepts an integer age that is valid from 18 to 60. Using…
- When does git perform a fast-forward merge of branch feature into main?
- Which of the following is NOT one of the four value statements of the Agile…
- Testing carried out by the developer organisation's own staff at the…
- In software engineering, what does SRS stand for?
- In Scrum, what is the fixed-length, time-boxed iteration in which the team…
- Which git command adds changes from the working directory to the staging area…
- "The results page must load within 2 seconds for up to 10,000 concurrent…
More technical & programming practice
Cloud & DevOps · GenAI Basics · Pseudo-code · C Programming · Java · Python · Data Structures · Algorithms
LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge