git stash temporarily shelves uncommitted changes (both staged and unstaged, by default) so you can switch to a clean working tree — to pull the latest main, switch branches to look at something else, or handle an urgent interruption — without committing half-finished work just to get it out of the way:
git stash # shelve current changes, working tree becomes clean
git switch main
git pull
git switch feature
git stash pop # re-apply the shelved changes and remove them from the stash list
git stash pop applies the most recent stash and removes it from the stash list; git stash apply applies it but leaves it in the list too, useful if you want to apply the same stashed changes to more than one branch. Stashes are stored as a special kind of commit internally, which is why git stash list can hold several independent stashes at once, each restorable individually by reference (git stash apply stash@{1}).