Git stash commands
Stash current changes
$ git stash save
The stash command saves your local modifications and reverts the working directory to match the HEAD
commit.
You may choose to omit save. If you do specify save, you can enter a message to label the stash content (e.g., git stash save “making a big change”).
Show stash list
$ git stash list
Recover changes from stash
$ git stash pop
The latest stash will be restored on your current work.
Adding a parameter of the stash ID (eg. stash@{1}
) will restore this specific stash to your current work.
Delete stash
$ git stash drop
The latest stash will be deleted.
Adding a parameter to the stash ID (eg. stash@{1}
) will delete this specific stash.
Delete all stashes
$ git stash clear