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 :

[email protected]{0}: WIP on master: 049d070 adds the home file
[email protected]{1}: WIP on master: c260051 Reverts "added file"
[email protected]{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 [email protected]{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...

Leave a Reply

Your email address will not be published. Required fields are marked *