ZANARDI Bruno

Software Developper

About
Resume

Git Blog

Git command `stash`

Definition

Stash the changes in a dirty working directory away.

Advanced usage

Save current changes in stash

$ git stash save

Save current changes and untracked files in stash

$ git stash save -u

Chose hunks saved in stash

$ git stash save --patch

Create a stash which ignore staged changes

$ git stash save -keep-index

List stashes

$ git stash list

Show a stash content

$ git stash show stash@{x}

Apply stash to working directory

$ git stash apply
$ git stash apply stash@{x}

Remove stash from stack

$ git stash drop
$ git stash drop stash@{x}

Apply and remove a stash

$ git stash pop
$ git stash pop stash@{x}

Create a branch from stash

$ git stash branch <name>
$ git stash branch <name> stash@{x}