intermediateUndoing Changes
Stash
The Definition
Stash temporarily shelves changes you've made, allowing you to work on something else.
Mental Model
"Stash is like putting work in a drawer. You can work on something else, then come back and get your work out of the drawer."
Visual Simulation
Live Engine
Workspace
Stash @{0}
CHANGESET #1
CHANGESET #2
CHANGESET #3
Watch Out (Common Pitfalls)
!
Stashing large chunks of work instead of committing
!
Forgetting about stashed changes
!
Not understanding that stash doesn't create commits
Hands-on Command
shell
~ $
git stash
git stash pop (restore and remove)
git stash apply (restore and keep)