Click any item to expand the explanation and examples.
πΎ Save
git stash save
Stash all tracked, modified files. Working directory becomes clean.
git stash # Stash changes
git stash -m "work in progress" # With a message
git stash -u # Include untracked files
git stash -a # Include untracked + ignored files
git stash --keep-index # Stash but keep staged changes
π€ Restore
git stash pop restore
Apply the most recent stash and remove it from the stash list.
git stash pop # Apply latest + delete from list
git stash pop stash@{2} # Apply specific stash + delete
If thereβs a conflict, the stash is NOT dropped. Resolve conflicts, then git stash drop.
git stash apply restore
Apply a stash but keep it in the stash list (useful if you want to apply to multiple branches).
git stash apply # Apply latest, keep in list
git stash apply stash@{1} # Apply specific stash
π Manage
git stash list / show / drop manage
git stash list # List all stashes
git stash show # Show latest stash diff summary
git stash show -p # Show latest stash full diff
git stash show stash@{1} -p # Show specific stash diff
git stash drop # Delete latest stash
git stash drop stash@{2} # Delete specific stash
git stash clear # Delete ALL stashes
git stash branch <name> manage
Create a new branch from the stash β useful when your stash conflicts with current branch.
git stash branch my-feature # Create branch + apply stash
git stash branch fix stash@{1} # From specific stash
See also: Git cheat sheet | Git stash pop conflict fix | Git merge conflict fix