git stash: save unfinished work for later
git stash takes your uncommitted changes, saves them on a shelf, and resets your files to the last commit. When you're ready, git stash pop puts the changes back, even on another branch.
Step by step
Put your changes aside:
$ git stashSee what's on the shelf:
$ git stash listBring the latest stash back:
$ git stash popOr throw it away:
$ git stash drop
Stash is perfect for interruptions: an urgent fix on main while you're halfway through a feature. New, untracked files aren't stashed unless you add -u.