Git Stash is a powerful Git feature that allows you to temporarily save uncommitted changes without creating a commit. It helps you switch branches or perform urgent fixes without losing unfinished work.
Git Stash saves your current working directory changes and resets it back to the last commit. You can reapply those saved changes anytime.
// Save all tracked changes temporarily
git stash
// List all saved stashes
git stash list
// Apply the most recent stash
git stash apply
// Apply a specific stash by index
git stash apply stash@{1}
// Remove a specific stash
git stash drop stash@{0}
// Remove all saved stashes
git stash clear
// Stash tracked and untracked files
git stash -u
// Stash everything including ignored files
git stash -a
// Apply and delete the latest stash
git stash pop
// Pop a specific stash
git stash pop stash@{1}
// Working Directory → Stash Stack → Apply / Pop → Working Directory
Modified Files
↓
git stash
↓
Stash Stack
↓
git stash apply / pop
git stash list frequently to stay organized