git stash
saves your work-in-progress changes.
Save
Stash changes not staged for commit:
git stash
Stash changes not staged for commit and untracked files:
git add .
git stash
Stash one or multiple files:
git stash push <file>
Stash using patch mode:
git stash -p
Stash with a message:
git stash save 'my message'
There’s discussion to deprecate
git stash save
in favor ofgit stash push
.
List
List stashes:
git stash list
Show
Show most recent stash:
git show stash@{0}
Replace
0
with the index of the stash you wish to see.
Pop
Pop most recent stash:
git stash pop
This removes the stash from the list.
Pop a specific stash:
git stash pop stash@{0}
Replace
0
with the index of the stash you wish to pop.
Apply
Apply most recent stash:
git stash apply
This does not remove the stash from the list.
Apply a specific stash:
git stash apply stash@{0}