Stash saves your uncommitted changes to a temporary stack so you can switch branches or pull without losing your work:
git stash # save all changes (tracked files)
git stash push -m "WIP: login form" # save with a label
git stash list # see all stashes
# stash@{0}: WIP: login form
# stash@{1}: On main: some old thing
git stash pop # restore latest stash + remove from stack
git stash apply # restore latest stash but KEEP it in stack
git stash apply stash@{1} # restore a specific stash
git stash drop stash@{0} # delete a specific stash
git stash clear # delete all stashes
# Working on feature, urgent bug arrives
git stash
git switch hotfix-branch
# fix the bug, commit, push...
git switch feature-branch
git stash pop
You've been editing work.txt but haven't committed. Stash your changes, make an "emergency" commit on a clean working tree, then pop the stash back.
Click "Run" to execute your code.