GIT

git stash

Manage multiple stashes

> git stash list
stash@{0}: WIP on master: 5002d47 our new homepage
stash@{1}: WIP on master: 5002d47 our new homepage
stash@{2}: WIP on master: 5002d47 our new homepage

It’s good practice to add a description in your stashes:

git stash save "this is a comment on the stash"

Pop stash

Popping your stash removes the changes from your stash and reapplies them to your working copy.

By default, git stash pop will re-apply the most recently created stash: stash@{0}

The simple thing is to list all stashes and then apply the one you need

> git stash list
stash@{0}: WIP on master: 5002d47 our new homepage
stash@{1}: WIP on master: 5002d47 our new homepage
stash@{2}: WIP on master: 5002d47 our new homepage

> git stash pop stash@{2}

Apply stash

Apply the changes to your working copy and keep them in your stash

git stash apply

If you want to select an specific stash:

git stash apply stash@{2}

Delete a stash

You can delete an specific stash:

git stash drop stash@{1}

or delete all your stashes:

git stash clear

Create a branch from your stash

git stash branch add-stylesheet stash@{1}

This checks out a new branch based on the commit that you created your stash from, and then pops your stashed changes onto it.