Skip to content

Instantly share code, notes, and snippets.

@azye
Last active February 26, 2020 21:56
Show Gist options
  • Save azye/15882b231d49213089bcb7eb75dea4a3 to your computer and use it in GitHub Desktop.
Save azye/15882b231d49213089bcb7eb75dea4a3 to your computer and use it in GitHub Desktop.

do git stash better

Stashes with a message

$ git stash save “Your stash message”.

List your stashes

$ git stash list

Apply specific stash

$ git stash apply stash@{1} # or name specified in git stash save

Pop specific stash

$ git stash pop stash@{1} # or name specified in git stash save

Shows diff of stash

$ git stash show # shows diff of stash at stack head

$ git stash show -p # shows full diff

$ git stash show stash@{1} # shows diff of specific stash

Create a branch with your stash

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

Clear all stashes in repo

$ git stash clear

Delete a stash

$ git stash drop # deletes stash at stack head
$ git stash drop stash@{1} # deletes specific stash 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment