Stash
Save
All Changes
Save all WIP changes in stack
git stash
Save unstaged changes in a stack with comments
git stash save "comment"
Specified Changes
Use push
with space separation to stash specified files
git stash push file_1 file_2
View
List of Stashes
View the list of stashes in the stack
git stash list
Diff
View the file-level diff vs last stash
git stash show
View the line-level diff vs last stash
git stash show -p
View the diff vs specific stash index number
git stash show -p stash@{n}
View the diff of n-th
stash against branch name
git diff stash@{n} branch_name
Applying Diff
Apply the most recent stashed changes (removes the stashed commit in the stack)
git stash pop
Apply n-th
stash index diff
version 2.11+
git stash apply n
OR
git stash pop "stash@{n}"
Apply the most recent stashed changes (keeps the stashed commit in the stack)
git stash apply
Delete Stash
Delete the most recent stash from the stack
git stash drop
Delete the n-th
stash from the list
git stash drop stash@{n}