CS FundamentalsModerateWipro · Accenture pattern

You are halfway through a change when an urgent bug needs fixing on the same branch. Which command shelves your uncommitted changes so the working tree is clean, letting you re-apply them later?

  1. A. git reset --hard
  2. B. git stash
  3. C. git checkout -- .
  4. D. git commit --amend

Correct answer: B. git stash

git stash saves tracked modifications (and staged changes) to a stack and reverts the working tree; git stash pop brings them back. reset --hard and checkout -- . would throw the work away.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic