Skip to content

Instantly share code, notes, and snippets.

@curtismckee
Last active March 9, 2021 02:46
Show Gist options
  • Save curtismckee/a13bff9e01938d15b6a75bc111a04586 to your computer and use it in GitHub Desktop.
Save curtismckee/a13bff9e01938d15b6a75bc111a04586 to your computer and use it in GitHub Desktop.
Git Stash Cheatsheet

git stash list

  • Lists all stashes on stack.

git stash apply stash@{0}

  • Applies the changes from stash but does not delete from stack.

git stash pop stash@{3}

  • Applies the changes from stash and deletes from the stack.

git stash -m "Message goes here." -- $(git diff --staged --name-only)

  • Stashes only staged files with name.

git stash show stash@{2}

  • Shows the diff of the stash.
  • Use the -p flag to show full diff.

git stash branch <name> stash@{1}

  • Creates a branch with changes from stash.

git stash drop stash@{0}

  • Deletes stash from stack.

git stash clear

  • Deletes all stashes from stack.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment