Skip to main content
Code and think

GIT Stash

Git stash saves all your current changes away and allows you to retrieve them when you need them. To store all your changes execute: git stash push (you can shorten to git stash) You can use -u to include untracked files: git stash push -u

PS: save option is deprecated.

To retrieve stored changes execute: git stash pop If you don't want the stash to be removed from the list use: git stash apply

You can save multiple stashes. In order to check use the git stash list. To drop the stash use git stash drop

and if you want to remove all the stashes use git stash clear

To stash only certain files you can use -- e.g. git stash push -- path/to/dir/or/file/to/stash

To stash only non-staged files use: git stash --keep-index

Reference