How to apply or restore stashed changes ?

If you want to apply your last changes you can do the following :

git stash apply


git stash pop

If you put too many things in the stash and don’t remember the order follow the below steps :

First lets see what we got in the stash:

git stash list

It should show something like the following :

stash@{0}: WIP on master: 049d070 adds the home file
stash@{1}: WIP on master: c260051 Reverts "added file"
stash@{2}: WIP on master: 20d80a5 adds logo

If you want to restore the changes in adds logo, you can do the following :

git stash apply stash@{2}

This is useful to apply one of the older stashes. If you don’t specify a stash, Git assumes the most recent stash and tries to apply it.

If you would like to know more about practical stash commands, let us know by leaving your comments.

You may also like...