Skip to content

Stash


Use Stash to save current changes in a temporary memory.

Create

git stash

Warning

Untracked changes are not stashed
Always use git status first

git stash -u

Info

Untracked changes are also stashed !

git stash save My Stash cool name

Info

Stash is saved with the name "My stash cool name"

List

git stash list

Exemple

Return a stash list

stash@{0}: On master : My stash cool name
stash@{1} : WIP on master : Remove IE9 support

Apply

Bring changes back

git stash apply

Info

Apply most recent stash

git stash apply stash@{1}

Info

Apply stash n°1

Delete

Delete remaining stash

git stash drop

Info

Drop most recent stash

git stash drop stash@{1}

Info

Drop stash n°1

Show

Display changes saved in stash

git stash show

Info

Show most recent stash

git stash show stash@{1}

Info

Show stash n°1

git stash show -p stash@{1}

Tip

Add more details with -p

Stash to another branch

Use Case : Move all current changes to a new branch

git stash 
git stash branch iglooStash

Info

Automatically create & move you to 'iglooStash' branch
Move changes to this branch
Remove latest stash