git stash temporarily saves your uncommitted changes and reverts your working directory to a clean state — so you can switch contexts (e.g. fix an urgent bug on another branch) without committing half-done work, then restore the changes later.
The problem stash solves
You're mid-work with uncommitted changes, but need to switch context urgently:
→ switch branches? Git may refuse (uncommitted changes would conflict) or carry
them along messily
→ commit half-done work? No — it's not ready (pollutes history)
→ STASH saves your changes aside, giving you a clean working directory to switch.
