Skip to content

Why it matters

Stash solves the "I need to switch branches but my work is half-done" problem without a throwaway commit on main.

Git refuses to switch branches if uncommitted changes would conflict with the target. Stash solves that: shelve the changes, switch, do the urgent work, switch back, restore. Without stash, you would have to commit half-done work to the branch (noise in history), or copy-paste the changes manually (dangerous).