Automation, Orchestration, and Scripting
A developer has uncommitted edits to tracked files on a feature branch when an urgent bug is reported on main. The edits are incomplete and must not be committed. Which approach lets the developer fix main and later resume the feature work?
Show the answer
Correct answerD. Run git stash, switch branches, and later run git stash pop
git stash saves the uncommitted changes and restores a clean working tree, and git stash pop reapplies them afterward. Staging with git add is tempting, but the staged changes would carry over to main rather than being set aside.