Software Engineering · Question 24 · Medium

Software Engineering question 24

You have uncommitted changes but must switch branches quickly to fix an urgent bug. Which git command temporarily shelves the changes so that you can restore them later?

  1. git reset --hard
  2. git stash
  3. git revert
  4. git clean -f
Answer and explanation

Answer: B. git stash

Explanation: git stash saves uncommitted changes on a stack and cleans the working directory; git stash pop restores them. reset --hard and clean -f would discard the work.

Previous: Which type of coupling between modules is considered the worst (strongest)? · Next: A bad commit has already been pushed to a shared main branch that teammates…

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

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