Temporary Saves: git stash pop & apply
Stashing saves uncommitted modifications (staged and unstaged files) to a temporary stack, returning your workspace back to a clean HEAD state.
1 Git Stash commands
Shell — Stash CLI
# Stash current uncommitted work
git stash
# Stash with a descriptive message
git stash save "Work in progress on login layout"
# List all stashed item slices
git stash list
# Apply the latest stashed change and remove it from stack
git stash pop
# Apply stashed change keeping it in stash stack
git stash apply stash@{0}
2 Code Challenge
Challenge: Edit a file without committing, run
git stash, switch branches to confirm a clean HEAD state, switch back, and restore your modifications using git stash pop.