CS FundamentalsHardAccenture · Infosys · Git interview

Your working tree has a modified tracked file f.txt and a new, never-added file u.txt. You run git stash. What does git status show next?

  1. A. u.txt as untracked; f.txt is stashed and clean
  2. B. A clean working tree; both files are stashed
  3. C. f.txt as modified; only u.txt is stashed
  4. D. Nothing changes, because stash needs a commit message

Correct answer: A. u.txt as untracked; f.txt is stashed and clean

By default git stash saves tracked changes (staged and unstaged) only; untracked files stay. git stash -u (or --include-untracked) would stash u.txt too.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic