git stash

Put uncommitted edits aside for a while and bring them back later

What it does

git stash moves your uncommitted changes into a separate store and brings the files back to the last commit. You need it when you must switch branches or run git pull right now, but your current work is not ready to commit.

git stash pop brings back the latest stashed edits and removes them from the store. You can stash several times; git stash list shows them all. New, untracked files are not stashed by default: add -u for them.

Syntax

git stash
git stash -u
git stash list
git stash pop

Examples

Related commands

Practise · All commands