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 remem­ber the order fol­low the below steps :

First lets see what we got in the stash:

git stash list

It should show some­thing 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 use­ful to apply one of the older stashes. If you don’t spec­ify a stash, Git assumes the most recent stash and tries to apply it.

If you would like to know more about prac­ti­cal stash com­mands, let us know by leav­ing your comments.

You may also like...