How To Use Git Stash

Git stash temporarily saves your changes and stashes them. You usually do it if you quickly need to work on something else without committing your current code.


Stash your work

The git stash command takes all your uncommitted changes (both staged and unstaged) and saves them in a pile.

git stash

This is how it looks before…

Before git stash

And this is after…

After git stash

Pop back your work

At any time, you can pop back your work. You do however need to commit or remove all changes you have made to the document.

git stash pop

And simple as that, our work is back, exactly the same as before.

Before git stash