Interview Prep/Git & GitHub/Undoing Mistakes

After `git stash pop` you got conflicts. Is your stash lost?

IntermediateScenarioUndoing Mistakes
Answer

Situation read → When pop conflicts, Git keeps the stash entry instead of dropping it.

What I'd do →

  1. git status to see conflicted files and resolve them like a merge.
  2. git add the resolved files, then git reset to unstage if you want them as plain changes.
  3. Drop the stash only when satisfied: git stash drop.
  4. To retry on a clean tree: git checkout . && git stash pop.

Why → Pop = apply + drop, but drop is skipped on failure, which protects you.

Interview tip → Prefer git stash apply for risky cases; drop manually after verifying.

All Git & GitHub questions Roadmap: Git & GitHub

More on Undoing Mistakes